AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Referenceabstract

#include "Unit.h"

Inheritance diagram for Unit:
WorldObject Object WorldLocation Position Creature Player TempSummon Minion Guardian Puppet Totem Pet

Public Types

typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 ~Unit () override
 
void Update (uint32 time) override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
void SetUInt32Value (uint16 index, uint32 value)
 
UnitGetOwner () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
ObjectGuid GetTransGUID () const override
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h.
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only.
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
NPCFlags GetNpcFlags () const
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
bool IsCritter () const
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
uint8 getClass () const
 
virtual bool IsClass (Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
uint32 GetFaction () const
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
void SetFaction (uint32 faction)
 
void RestoreFaction ()
 
uint32 GetOldFactionId () const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 Interrupt the unit cast for all the current spells.
 
bool AttackStop ()
 Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool CanHaveThreatList (bool skipAliveCheck=false) const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
virtual bool HasWeapon (WeaponAttackType type) const =0
 
bool HasMainhandWeapon () const
 
bool HasOffhandWeapon () const
 
bool HasRangedWeapon () const
 
bool hasMainhandWeaponForAttack () const
 
virtual bool HasWeaponForAttack (WeaponAttackType type) const
 
bool HasMainhandWeaponForAttack () const
 
bool HasOffhandWeaponForAttack () const
 
bool HasRangedWeaponForAttack () const
 
bool CanUseAttackType (uint8 attacktype) const
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
float GetCreateStat (Stats stat) const
 
void SetCreateStat (Stats stat, float val)
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
void InitStatBuffMods ()
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
void SetCanModifyStats (bool modifyStats)
 
bool CanModifyStats () const
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
float GetHealthPct () const
 
int32 GetHealthGain (int32 dVal)
 
uint32 GetCreateHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
void SetCreateHealth (uint32 val)
 
Powers getPowerType () const
 
virtual bool HasActivePowerType (Powers power)
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
float GetPowerPct (Powers power) const
 
uint32 GetCreatePowers (Powers power) const
 
void setPowerType (Powers power)
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
uint32 GetCreateMana () const
 
void SetCreateMana (uint32 val)
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
bool CanApplyResilience () const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
uint32 GetResistance (SpellSchoolMask mask) const
 
uint32 GetResistance (SpellSchools school) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistance (SpellSchools school, int32 val)
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, Unit *caster) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
PlayerGetAffectingPlayer () const
 
UnitGetFirstControlled () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
void SetCharm (Unit *target, bool apply)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void UpdateCharmAI ()
 
void RemoveCharmedBy (Unit *charmer)
 
void RemoveCharmAuras ()
 
void RemoveAllControlled (bool onDeath=false)
 
void DeleteCharmInfo ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveBindSightAuras ()
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAuras (SearchMethod sm, std::vector< uint32 > &spellIds) const
 Check if unit has ANY or ALL specified auras.
 
template<typename... Auras>
bool HasAnyAuras (Auras... spellIds) const
 Checks if the unit has ANY specified auras.
 
template<typename... Auras>
bool HasAllAuras (Auras... spellIds) const
 Checks if the unit has ALL specified auras.
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
PlayerGetSpellModOwner () const
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool HasSpell (uint32) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool IsInFlight () const
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool IsMovementPreventedByCasting () const
 
virtual bool CanEnterWater () const =0
 
virtual bool CanSwim () const
 this method checks the current flag of a unit
 
bool CanFreeMove () const
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
void propagateSpeedChange ()
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true)
 
virtual bool SetSwim (bool enable)
 
virtual bool SetCanFly (bool enable, bool packetOnly=false)
 Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().
 
virtual bool SetWaterWalking (bool enable, bool packetOnly=false)
 Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players.
 
virtual bool SetFeatherFall (bool enable, bool packetOnly=false)
 
virtual bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------—
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
bool HasGhostAura () const
 
bool HasMountedAura () const
 
bool HasWaterWalkAura () const
 
bool HasFeatherFallAura () const
 
bool HasHoverAura () const
 
bool HasFlyAura () const
 
bool HasSpiritOfRedemptionAura () const
 
bool HasPreventsFleeingAura () const
 
bool HasPreventDurabilityLossAura () const
 
bool HasPreventResurectionAura () const
 
bool HasTransformAura () const
 
bool HasInterruptRegenAura () const
 
bool HasNoPVPCreditAura () const
 
bool HasWaterBreathingAura () const
 
bool HasIgnoreHitDirectionAura () const
 
bool HasSpellMagnetAura () const
 
bool HasOpenStableAura () const
 
bool HasCloneCasterAura () const
 
bool HasReflectSpellsAura () const
 
bool HasDetectAmoreAura () const
 
bool HasAllowOnlyAbilityAura () const
 
bool HasPeriodicDummyAura () const
 
bool HasControlVehicleAura () const
 
bool HasAOECharmAura () const
 
bool HasDetectSpellsAura () const
 
bool HasPacifySilenceAura () const
 
bool HasSilenceAura () const
 
bool HasShapeshiftAura () const
 
bool HasDecreaseSpeedAura () const
 
bool HasPacifyAura () const
 
bool HasIgnoreTargetResistAura () const
 
bool HasIncreaseMountedSpeedAura () const
 
bool HasIncreaseMountedFlightSpeedAura () const
 
bool HasThreatAura () const
 
bool HasAttackerSpellCritChanceAura () const
 
bool HasUnattackableAura () const
 
bool HasHealthRegenInCombatAura () const
 
bool HasRegenDuringCombatAura () const
 
bool HasFearAura () const
 
bool HasConfuseAura () const
 
bool HasRootAura () const
 
bool HasStunAura () const
 
bool HasTauntAura () const
 
bool HasStealthAura () const
 
bool HasStealthDetectAura () const
 
bool HasInvisibilityAura () const
 
bool HasInvisibilityDetectAura () const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
void UpdateAuraForGroup (uint8 slot)
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
uint32 GetVirtualItemId (uint32 slot) const
 
void SetVirtualItem (uint32 slot, uint32 itemId)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
bool IsInDisallowedMountForm () const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
virtual float GetFollowAngle () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
CreatureGetCompanionPet () const
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
void UnsummonAllTotems (bool onDeath=false)
 
TransportBaseGetDirectTransport () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void HandleEmoteCommand (uint32 emoteId)
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsAttackSpeedOverridenShapeShift () const
 
bool IsInFeralForm () const
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void DeMorph ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, float displayScale=1.f)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
float GetCollisionHeight () const override
 Return collision height sent to client.
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client.
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client.
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendComboPoints ()
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------—
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
void SendMovementFlagUpdate (bool self=false)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
void BuildMovementPacket (ByteBuffer *data) const
 
void OutDebugInfo () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle, bool disableWarning=false)
 
Position GetNearPosition (float dist, float angle, bool disableWarning=false)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius, bool disableWarning=false)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim.
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual void Heartbeat ()
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void ProcDamageAndSpell (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Protected Types

typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsInvisibleDueToDespawn () const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union { 
 
   int32 *   m_int32Values 
 
   uint32 *   m_uint32Values 
 
   float *   m_floatValues 
 
};  
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Types

typedef std::unordered_map< uint64, BuildValuesCachedBufferValuesUpdateCache
 

Private Member Functions

bool IsTriggeredAtSpellProcEvent (Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
 
bool HandleDummyAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, ProcEventInfo const &eventInfo)
 
bool HandleAuraProc (Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
 
bool HandleProcTriggerSpell (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
 
bool HandleOverrideClassScriptAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
 
bool HandleAuraRaidProcFromChargeWithValue (AuraEffect *triggeredByAura)
 
bool HandleAuraRaidProcFromCharge (AuraEffect *triggeredByAura)
 
void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
void PatchValuesUpdate (ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
 
void InvalidateValuesUpdateCache ()
 
float processDummyAuras (float TakenTotalMod) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 

Private Attributes

uint32 m_state
 
uint32 m_CombatTimer
 
uint32 m_lastManaUse
 
Diminishing m_Diminishing
 
HostileRefMgr m_HostileRefMgr
 
FollowerRefMgr m_FollowingRefMgr
 
Unitm_comboTarget
 
int8 m_comboPoints
 
std::unordered_set< Unit * > m_ComboPointHolders
 
RedirectThreatInfo _redirectThreatInfo
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
uint32 _oldFactionId
 faction before charm
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed?
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 
ValuesUpdateCache _valuesUpdateCache
 

Detailed Description

Member Typedef Documentation

◆ AttackerSet

typedef std::unordered_set<Unit*> Unit::AttackerSet

◆ AuraApplicationList

◆ AuraApplicationMap

◆ AuraApplicationMapBounds

typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> Unit::AuraApplicationMapBounds

◆ AuraApplicationMapBoundsNonConst

typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> Unit::AuraApplicationMapBoundsNonConst

◆ AuraEffectList

typedef std::list<AuraEffect*> Unit::AuraEffectList

◆ AuraList

typedef std::list<Aura*> Unit::AuraList

◆ AuraMap

typedef std::multimap<uint32, Aura*> Unit::AuraMap

◆ AuraMapBounds

typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> Unit::AuraMapBounds

◆ AuraMapBoundsNonConst

typedef std::pair<AuraMap::iterator, AuraMap::iterator> Unit::AuraMapBoundsNonConst

◆ AuraStateAurasMap

◆ AuraStateAurasMapBounds

typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> Unit::AuraStateAurasMapBounds

◆ CharmThreatMap

typedef std::map<ObjectGuid, float> Unit::CharmThreatMap
protected

◆ ComboPointHolderSet

◆ ControlSet

typedef std::set<Unit*> Unit::ControlSet

◆ Diminishing

◆ DynObjectList

typedef std::list<DynamicObject*> Unit::DynObjectList
protected

◆ GameObjectList

typedef GuidList Unit::GameObjectList
protected

◆ PetAuraSet

typedef std::set<PetAura const*> Unit::PetAuraSet

◆ ValuesUpdateCache

typedef std::unordered_map<uint64 , BuildValuesCachedBuffer> Unit::ValuesUpdateCache
private

◆ VisibleAuraMap

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
override
339{
340 // set current spells as deletable
341 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
342 if (m_currentSpells[i])
343 {
345 m_currentSpells[i] = nullptr;
346 }
347
349
350 delete i_motionMaster;
351 delete m_charmInfo;
352 delete movespline;
353
356 ASSERT(m_attackers.empty());
357
358 // pussywizard: clear m_sharedVision along with back references
359 if (!m_sharedVision.empty())
360 {
361 do
362 {
363 Player* p = *(m_sharedVision.begin());
364 p->m_isInSharedVisionOf.erase(this);
365 m_sharedVision.remove(p);
366 } while (!m_sharedVision.empty());
367 }
368
369 ASSERT(m_Controlled.empty());
370 ASSERT(m_appliedAuras.empty());
371 ASSERT(m_ownedAuras.empty());
372 ASSERT(m_removedAuras.empty());
373 ASSERT(m_gameObj.empty());
374 ASSERT(m_dynObj.empty());
375
376 if (m_movedByPlayer && m_movedByPlayer != this)
377 LOG_INFO("misc", "Unit::~Unit (A1)");
378
380}
std::uint8_t uint8
Definition Define.h:109
#define ASSERT
Definition Errors.h:68
#define LOG_INFO(filterType__,...)
Definition Log.h:165
#define CURRENT_MAX_SPELL
Definition Unit.h:544
Definition Player.h:1081
std::set< Unit * > m_isInSharedVisionOf
Definition Player.h:2338
void SetReferencedFromCurrent(bool yes)
Definition Spell.h:563
bool m_duringRemoveFromWorld
Definition Unit.h:2164
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition Unit.h:2076
AuraList m_removedAuras
Definition Unit.h:2080
ControlSet m_Controlled
Definition Unit.h:1990
Movement::MoveSpline * movespline
Definition Unit.h:2029
CharmInfo * m_charmInfo
Definition Unit.h:2097
MotionMaster * i_motionMaster
Definition Unit.h:2100
void _DeleteRemovedAuras()
Definition Unit.cpp:3835
DynObjectList m_dynObj
Definition Unit.h:2070
SafeUnitPointer m_movedByPlayer
Definition Unit.h:1992
AttackerSet m_attackers
Definition Unit.h:2062
Unit * m_attacking
Definition Unit.h:2063
GameObjectList m_gameObj
Definition Unit.h:2073
AuraMap m_ownedAuras
Definition Unit.h:2078
AuraApplicationMap m_appliedAuras
Definition Unit.h:2079
static void HandleSafeUnitPointersOnDelete(Unit *thisUnit)
Definition Unit.cpp:4329
SharedVisionList m_sharedVision
Definition Unit.h:2098

References _DeleteRemovedAuras(), ASSERT, CURRENT_MAX_SPELL, HandleSafeUnitPointersOnDelete(), i_motionMaster, LOG_INFO, m_appliedAuras, m_attackers, m_attacking, m_charmInfo, m_Controlled, m_currentSpells, m_duringRemoveFromWorld, m_dynObj, m_gameObj, Player::m_isInSharedVisionOf, m_movedByPlayer, m_ownedAuras, m_removedAuras, m_sharedVision, movespline, and Spell::SetReferencedFromCurrent().

◆ Unit()

Unit::Unit ( bool  isWorldObject)
explicitprotected
203 : WorldObject(isWorldObject),
204 m_movedByPlayer(nullptr),
206 IsAIEnabled(false),
207 NeedChangeAI(false),
209 m_CreatedByPlayer(false),
211 i_AI(nullptr),
212 i_disabledAI(nullptr),
213 m_realRace(0),
214 m_race(0),
216 m_procDeep(0),
218 i_motionMaster(new MotionMaster(this)),
219 m_regenTimer(0),
220 m_ThreatMgr(this),
221 m_vehicle(nullptr),
222 m_vehicleKit(nullptr),
224 m_HostileRefMgr(this),
225 m_comboTarget(nullptr),
227{
228#ifdef _MSC_VER
229#pragma warning(default:4355)
230#endif
233
235
242
243 m_canDualWield = false;
244
245 m_rootTimes = 0;
246
247 m_state = 0;
249
250 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
251 m_currentSpells[i] = nullptr;
252
253 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
254 m_SummonSlot[i].Clear();
255
256 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
257 m_ObjectSlot[i].Clear();
258
260
261 m_interruptMask = 0;
262 m_transform = 0;
263 m_canModifyStats = false;
264
265 for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i)
266 m_spellImmune[i].clear();
267
268 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
269 {
274 }
275 // implement 50% base damage from offhand
277
278 for (uint8 i = 0; i < MAX_ATTACK; ++i)
279 {
282
283 m_weaponDamage[i][MINDAMAGE][1] = 0.f;
284 m_weaponDamage[i][MAXDAMAGE][1] = 0.f;
285 }
286
287 for (uint8 i = 0; i < MAX_STATS; ++i)
288 m_createStats[i] = 0.0f;
289
290 m_attacking = nullptr;
291 m_modMeleeHitChance = 0.0f;
293 m_modSpellHitChance = 0.0f;
295
296 m_CombatTimer = 0;
297 m_lastManaUse = 0;
298
299 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
300 m_threatModifier[i] = 1.0f;
301
302 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
303 m_speed_rate[i] = 1.0f;
304
305 m_charmInfo = nullptr;
306
308
309 // remove aurastates allowing special moves
310 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
311 m_reactiveTimer[i] = 0;
312
313 m_cleanupDone = false;
315
317
318 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
323
324 m_applyResilience = false;
325 _instantCast = false;
326
327 _lastLiquid = nullptr;
328
329 _oldFactionId = 0;
330
331 _isWalkingBeforeCharm = false;
332
334}
@ TYPEID_UNIT
Definition ObjectGuid.h:35
@ TYPEMASK_UNIT
Definition ObjectGuid.h:49
@ SERVERSIDE_VISIBILITY_GHOST
Definition SharedDefines.h:1274
#define MAX_STATS
Definition SharedDefines.h:265
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:292
@ GHOST_VISIBILITY_ALIVE
Definition SharedDefines.h:1281
#define MAX_SPELL_IMMUNITY
Definition SharedDefines.h:1404
@ UNIT_MASK_NONE
Definition UnitDefines.h:155
#define MAX_MOVE_TYPE
Definition UnitDefines.h:360
@ MINDAMAGE
Definition Unit.h:135
@ MAXDAMAGE
Definition Unit.h:136
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:166
@ UNIT_MOD_END
Definition Unit.h:168
#define MAX_SUMMON_SLOT
Definition Unit.h:607
@ OFF_ATTACK
Definition Unit.h:210
@ MAX_ATTACK
Definition Unit.h:212
@ BASE_ATTACK
Definition Unit.h:209
@ RANGED_ATTACK
Definition Unit.h:211
@ BASE_VALUE
Definition Unit.h:126
@ TOTAL_VALUE
Definition Unit.h:128
@ TOTAL_PCT
Definition Unit.h:129
@ BASE_PCT
Definition Unit.h:127
#define BASE_MAXDAMAGE
Definition Unit.h:40
@ MAX_REACTIVE
Definition Unit.h:599
#define MAX_GAMEOBJECT_SLOT
Definition Unit.h:609
#define BASE_MINDAMAGE
Definition Unit.h:39
@ UPDATEFLAG_LIVING
Definition UpdateData.h:44
@ UPDATEFLAG_STATIONARY_POSITION
Definition UpdateData.h:45
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition Object.h:377
Definition MotionMaster.h:112
Definition MoveSpline.h:40
uint16 m_objectType
Definition Object.h:245
uint16 m_updateFlag
Definition Object.h:248
TypeID m_objectTypeId
Definition Object.h:247
uint32 m_reactiveTimer[MAX_REACTIVE]
Definition Unit.h:2102
uint32 m_lastSanctuaryTime
Definition Unit.h:2006
LiquidTypeEntry const * _lastLiquid
Definition Unit.h:2113
uint32 m_transform
Definition Unit.h:2074
uint32 m_CombatTimer
Definition Unit.h:2147
bool m_canModifyStats
Definition Unit.h:2092
UnitAI * i_disabledAI
Definition Unit.h:2051
bool NeedChangeAI
Definition Unit.h:2013
uint32 m_state
Definition Unit.h:2146
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]
Definition Unit.h:2090
int32 m_attackTimer[MAX_ATTACK]
Definition Unit.h:2058
float m_modAttackSpeedPct[3]
Definition Unit.h:2003
uint8 m_realRace
Definition Unit.h:2053
Vehicle * m_vehicle
Definition Unit.h:2109
uint32 m_rootTimes
Definition Unit.h:2119
uint8 m_race
Definition Unit.h:2054
UnitAI * i_AI
Definition Unit.h:2050
uint32 _lastExtraAttackSpell
Definition Unit.h:2169
bool _instantCast
Definition Unit.h:2117
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]
Definition Unit.h:1995
RedirectThreatInfo _redirectThreatInfo
Definition Unit.h:2161
float m_createStats[MAX_STATS]
Definition Unit.h:2060
float m_modRangedHitChance
Definition Unit.h:1998
DeathState m_deathState
Definition Unit.h:2065
uint32 m_unitTypeMask
Definition Unit.h:2112
uint32 m_removedAurasCount
Definition Unit.h:2082
ThreatMgr m_ThreatMgr
Definition Unit.h:2105
Unit * m_comboTarget
Definition Unit.h:2157
AuraMap::iterator m_auraUpdateIterator
Definition Unit.h:2081
bool m_AutoRepeatFirstCast
Definition Unit.h:2056
uint16 m_delayed_unit_ai_notify_timer
Definition Unit.h:2025
int32 m_regenTimer
Definition Unit.h:2103
bool bRequestForcedVisibilityUpdate
Definition Unit.h:2026
bool m_ControlledByPlayer
Definition Unit.h:2015
uint32 m_last_notify_mstime
Definition Unit.h:2023
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition Unit.h:2005
int8 m_comboPoints
Definition Unit.h:2158
uint32 _oldFactionId
faction before charm
Definition Unit.h:2166
int32 m_baseSpellCritChance
Definition Unit.h:2000
float m_modMeleeHitChance
Definition Unit.h:1997
float m_weaponDamage[MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
Definition Unit.h:2091
Position m_last_notify_position
Definition Unit.h:2022
Vehicle * m_vehicleKit
Definition Unit.h:2110
bool IsAIEnabled
Definition Unit.h:2012
HostileRefMgr m_HostileRefMgr
Definition Unit.h:2153
bool m_applyResilience
Definition Unit.h:2116
bool m_canDualWield
Definition Unit.h:1988
uint32 m_interruptMask
Definition Unit.h:2088
int32 m_procDeep
Definition Unit.h:2067
float m_speed_rate[MAX_MOVE_TYPE]
Definition Unit.h:2095
float m_modSpellHitChance
Definition Unit.h:1999
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition Unit.h:1994
bool m_cleanupDone
Definition Unit.h:2163
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition Unit.h:2167
bool m_CreatedByPlayer
Definition Unit.h:2016
uint16 m_delayed_unit_relocation_timer
Definition Unit.h:2024
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition Unit.h:2002
uint32 m_lastManaUse
Definition Unit.h:2148
Definition Object.h:410
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition Object.h:528
void Relocate(float x, float y)
Definition Position.h:72
Definition ThreatMgr.h:293

References _instantCast, _isWalkingBeforeCharm, _lastExtraAttackSpell, _lastLiquid, _oldFactionId, _redirectThreatInfo, Alive, BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, bRequestForcedVisibilityUpdate, CURRENT_MAX_SPELL, GHOST_VISIBILITY_ALIVE, m_applyResilience, m_attacking, m_attackTimer, m_auraModifiersGroup, m_auraUpdateIterator, m_baseSpellCritChance, m_canDualWield, m_canModifyStats, m_charmInfo, m_cleanupDone, m_CombatTimer, m_createStats, m_currentSpells, m_deathState, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_duringRemoveFromWorld, m_interruptMask, m_last_notify_mstime, m_last_notify_position, m_lastManaUse, m_modAttackSpeedPct, m_modMeleeHitChance, m_modRangedHitChance, m_modSpellHitChance, m_ObjectSlot, Object::m_objectType, Object::m_objectTypeId, m_ownedAuras, m_reactiveTimer, m_rootTimes, WorldObject::m_serverSideVisibility, m_speed_rate, m_spellImmune, m_state, m_SummonSlot, m_threatModifier, m_transform, Object::m_updateFlag, m_weaponDamage, MAX_ATTACK, MAX_GAMEOBJECT_SLOT, MAX_MOVE_TYPE, MAX_REACTIVE, MAX_SPELL_IMMUNITY, MAX_SPELL_SCHOOL, MAX_STATS, MAX_SUMMON_SLOT, MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), TOTAL_PCT, TOTAL_VALUE, TYPEID_UNIT, TYPEMASK_UNIT, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_END, UPDATEFLAG_LIVING, and UPDATEFLAG_STATIONARY_POSITION.

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit pAttacker)
inlineprivate
2142{ m_attackers.insert(pAttacker); }

References m_attackers.

Referenced by Attack().

◆ _AddAura()

void Unit::_AddAura ( UnitAura aura,
Unit caster 
)
4415{
4417 m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
4418
4420
4421 if (aura->IsRemoved())
4422 return;
4423
4425 if (aura->IsSingleTarget())
4426 {
4427 ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
4428 /* @HACK: Player is not in world during loading auras.
4429 * Single target auras are not saved or loaded from database
4430 * but may be created as a result of aura links (player mounts with passengers)
4431 */
4432
4433 // register single target aura
4434 caster->GetSingleCastAuras().push_back(aura);
4435 // remove other single target auras
4436 Unit::AuraList& scAuras = caster->GetSingleCastAuras();
4437 for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
4438 {
4439 if ((*itr) != aura &&
4440 (*itr)->IsSingleTargetWith(aura))
4441 {
4442 (*itr)->Remove();
4443 itr = scAuras.begin();
4444 }
4445 else
4446 ++itr;
4447 }
4448 }
4449}
@ SPELL_AURA_CONTROL_VEHICLE
Definition SpellAuraDefines.h:299
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:105
bool IsRemoved() const
Definition SpellAuras.h:161
bool IsSingleTargetWith(Aura const *aura) const
Definition SpellAuras.cpp:1142
uint32 GetId() const
Definition SpellAuras.cpp:466
bool HasEffectType(AuraType type) const
Definition SpellAuras.cpp:1222
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
void SetIsSingleTarget(bool val)
Definition SpellAuras.h:166
bool IsSingleTarget() const
Definition SpellAuras.h:164
bool IsInWorld() const
Definition Object.h:107
ObjectGuid GetGUID() const
Definition Object.h:113
bool IsSingleTarget() const
Definition SpellInfo.cpp:1374
void _RemoveNoStackAurasDueToAura(Aura *aura)
Definition Unit.cpp:4667
std::list< Aura * > AuraList
Definition Unit.h:653
bool IsDuringRemoveFromWorld() const
Definition Unit.h:674
AuraList & GetSingleCastAuras()
Definition Unit.h:1356

References _RemoveNoStackAurasDueToAura(), ASSERT, Aura::GetCasterGUID(), Object::GetGUID(), Aura::GetId(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::HasEffectType(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Aura::IsRemoved(), Aura::IsSingleTarget(), SpellInfo::IsSingleTarget(), Aura::IsSingleTargetWith(), m_cleanupDone, m_ownedAuras, Aura::SetIsSingleTarget(), and SPELL_AURA_CONTROL_VEHICLE.

Referenced by UnitAura::UnitAura().

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )
5489{
5490 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5491 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
5492}
@ AURA_EFFECT_HANDLE_STAT
Definition SpellAuraDefines.h:46

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_ApplyAllStatBonuses().

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication aurApp,
uint8  effMask 
)
4506{
4507 Aura* aura = aurApp->GetBase();
4508
4510
4511 if (aurApp->GetRemoveMode())
4512 return;
4513
4514 Unit* caster = aura->GetCaster();
4515
4516 // Update target aura state flag
4517 SpellInfo const* spellInfo = aura->GetSpellInfo();
4518 if (AuraStateType aState = spellInfo->GetAuraState())
4519 {
4520 uint32 aStateMask = (1 << (aState - 1));
4521 // force update so the new caster registers it
4522 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) && HasFlag(UNIT_FIELD_AURASTATE, aStateMask))
4524 else
4525 ModifyAuraState(aState, true);
4526 }
4527
4528 if (aurApp->GetRemoveMode())
4529 return;
4530
4531 // Sitdown on apply aura req seated
4534
4535 if (aurApp->GetRemoveMode())
4536 return;
4537
4538 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
4539
4540 // apply effects of the aura
4541 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4542 {
4543 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
4544 aurApp->_HandleEffect(i, true);
4545 }
4546
4547 sScriptMgr->OnAuraApply(this, aura);
4548}
#define MAX_SPELL_EFFECTS
Definition DBCStructure.h:1636
std::uint32_t uint32
Definition Define.h:107
#define sScriptMgr
Definition ScriptMgr.h:709
#define PER_CASTER_AURA_STATE_MASK
Definition SharedDefines.h:1318
AuraStateType
Definition SharedDefines.h:1288
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition SpellDefines.h:61
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:33
@ UNIT_FIELD_AURASTATE
Definition UpdateFields.h:119
void _HandleEffect(uint8 effIndex, bool apply)
Definition SpellAuras.cpp:161
Aura * GetBase() const
Definition SpellAuras.h:62
AuraRemoveMode GetRemoveMode() const
Definition SpellAuras.h:73
Definition SpellAuras.h:87
Unit * GetCaster() const
Definition SpellAuras.cpp:471
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition SpellAuras.cpp:1265
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:889
void ForceValuesUpdateAtIndex(uint32)
Definition Object.cpp:2078
Definition SpellInfo.h:316
AuraStateType GetAuraState() const
Definition SpellInfo.cpp:2060
uint32 AuraInterruptFlags
Definition SpellInfo.h:353
Definition Unit.h:636
void ModifyAuraState(AuraStateType flag, bool apply)
Definition Unit.cpp:10520
void SetStandState(uint8 state)
Definition Unit.cpp:16749
bool IsSitState() const
Definition Unit.cpp:16734

References AuraApplication::_HandleEffect(), _RemoveNoStackAurasDueToAura(), AURA_INTERRUPT_FLAG_NOT_SEATED, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), Aura::HandleAuraSpecificMods(), Object::HasFlag(), IsSitState(), MAX_SPELL_EFFECTS, ModifyAuraState(), PER_CASTER_AURA_STATE_MASK, SetStandState(), sScriptMgr, UNIT_FIELD_AURASTATE, and UNIT_STAND_STATE_SIT.

Referenced by _ApplyAuraEffect().

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura aura,
uint8  effIndex 
)
4492{
4493 ASSERT(aura);
4494 ASSERT(aura->HasEffect(effIndex));
4496 ASSERT(aurApp);
4497 if (!aurApp->GetEffectMask())
4498 _ApplyAura(aurApp, 1 << effIndex);
4499 else
4500 aurApp->_HandleEffect(effIndex, true);
4501}
Definition SpellAuras.h:37
uint8 GetEffectMask() const
Definition SpellAuras.h:66
bool HasEffect(uint8 effIndex) const
Definition SpellAuras.h:173
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition SpellAuras.h:183
void _ApplyAura(AuraApplication *aurApp, uint8 effMask)
Definition Unit.cpp:4505

References _ApplyAura(), AuraApplication::_HandleEffect(), ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetEffectMask(), Object::GetGUID(), and Aura::HasEffect().

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura aura,
uint8  effMask 
)
4454{
4455 // can't apply aura on unit which is going to be deleted - to not create a memory leak
4457 // aura musn't be removed
4458 ASSERT(!aura->IsRemoved());
4459
4460 // aura mustn't be already applied on target
4461 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
4462
4463 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
4464 uint32 aurId = aurSpellInfo->Id;
4465
4466 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
4467 // Xinef: Added IsAllowingDeadTarget check
4468 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (!IsPlayer() || !ToPlayer()->GetSession()->PlayerLoading()))
4469 return nullptr;
4470
4471 Unit* caster = aura->GetCaster();
4472
4473 AuraApplication* aurApp = new AuraApplication(this, caster, aura, effMask);
4474 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
4475
4476 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4477 // xinef: even if it gets removed, it will be reapplied in a second
4478 if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner())
4479 {
4480 m_interruptableAuras.push_back(aurApp);
4481 AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
4482 }
4483
4484 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
4485 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
4486
4487 aura->_ApplyForTarget(this, caster, aurApp);
4488 return aurApp;
4489}
WorldObject * GetOwner() const
Definition SpellAuras.h:107
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition SpellAuras.h:185
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition SpellAuras.cpp:492
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
bool IsDeathPersistent() const
Definition SpellInfo.cpp:1217
uint32 Id
Definition SpellInfo.h:320
bool IsAllowingDeadTarget() const
Definition SpellInfo.cpp:1227
void AddInterruptMask(uint32 mask)
Definition Unit.h:1526
bool IsAlive() const
Definition Unit.h:1704
AuraApplicationList m_interruptableAuras
Definition Unit.h:2086
AuraStateAurasMap m_auraStateAuras
Definition Unit.h:2087

References Aura::_ApplyForTarget(), AddInterruptMask(), ASSERT, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), Aura::GetCaster(), Object::GetGUID(), Aura::GetOwner(), Aura::GetSpellInfo(), SpellInfo::Id, IsAlive(), SpellInfo::IsAllowingDeadTarget(), Aura::IsAppliedOnTarget(), SpellInfo::IsDeathPersistent(), Object::IsPlayer(), Aura::IsRemoved(), m_appliedAuras, m_auraStateAuras, m_cleanupDone, m_interruptableAuras, and Object::ToPlayer().

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected
3836{
3837 while (!m_removedAuras.empty())
3838 {
3839 delete m_removedAuras.front();
3840 m_removedAuras.pop_front();
3841 }
3842}

References m_removedAuras.

Referenced by _UpdateSpells(), and ~Unit().

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)
19678{
19679 // Must be called only from aura handler
19680 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
19681 return;
19682
19683 if (m_vehicle)
19684 {
19685 if (m_vehicle == vehicle)
19686 {
19687 if (seatId >= 0 && seatId != GetTransSeat())
19688 {
19689 LOG_DEBUG("vehicles", "EnterVehicle: {} leave vehicle {} seat {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
19690 ChangeSeat(seatId);
19691 }
19692
19693 return;
19694 }
19695 else
19696 {
19697 LOG_DEBUG("vehicles", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
19698 ExitVehicle();
19699 }
19700 }
19701
19702 if (!aurApp || aurApp->GetRemoveMode())
19703 return;
19704
19705 if (Player* player = ToPlayer())
19706 {
19707 if (vehicle->GetBase()->IsPlayer() && player->IsInCombat())
19708 return;
19709
19710 sScriptMgr->AnticheatSetUnderACKmount(player);
19711
19713 player->StopCastingCharm();
19714 player->StopCastingBindSight();
19715 Dismount();
19717
19718 // drop flag at invisible in bg
19719 if (Battleground* bg = player->GetBattleground())
19720 bg->EventPlayerDroppedFlag(player);
19721
19723 player->GetSession()->SendPacket(&data);
19724 }
19725
19726 ASSERT(!m_vehicle);
19727 m_vehicle = vehicle;
19728
19729 if (!m_vehicle->AddPassenger(this, seatId))
19730 {
19731 m_vehicle = nullptr;
19732 return;
19733 }
19734
19735 // Xinef: remove movement auras when entering vehicle (food buffs etc)
19737}
#define LOG_DEBUG(filterType__,...)
Definition Log.h:169
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
@ AURA_INTERRUPT_FLAG_MOVE
Definition SpellDefines.h:46
@ AURA_INTERRUPT_FLAG_TURNING
Definition SpellDefines.h:47
Definition Battleground.h:303
uint32 GetEntry() const
Definition Object.h:115
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4129
void Dismount()
Definition Unit.cpp:13547
bool IsOnVehicle(Unit const *vehicle) const
Definition Unit.h:1837
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5110
void ChangeSeat(int8 seatId, bool next=true)
Definition Unit.cpp:19739
Vehicle * GetVehicleKit() const
Definition Unit.h:1835
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition Unit.cpp:5181
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:19758
Unit * GetBase() const
May be called from scripts.
Definition Vehicle.h:37
bool AddPassenger(Unit *passenger, int8 seatId=-1)
Definition Vehicle.cpp:317
int8 GetTransSeat() const
Definition Object.h:603
Definition WorldPacket.h:26
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition Opcodes.h:1211

References Vehicle::AddPassenger(), ASSERT, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, ChangeSeat(), Dismount(), ExitVehicle(), Vehicle::GetBase(), Object::GetEntry(), AuraApplication::GetRemoveMode(), WorldObject::GetTransSeat(), GetVehicleKit(), InterruptNonMeleeSpells(), IsAlive(), IsOnVehicle(), Object::IsPlayer(), LOG_DEBUG, m_vehicle, RemoveAurasByType(), RemoveAurasWithInterruptFlags(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SPELL_AURA_MOUNTED, sScriptMgr, and Object::ToPlayer().

Referenced by AuraEffect::HandleAuraControlVehicle().

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)
19796{
19797 if (!m_vehicle)
19798 return;
19799
19800 // This should be done before dismiss, because there may be some aura removal
19803
19804 Player* player = ToPlayer();
19805
19806 // If player is on mouted duel and exits the mount should immediatly lose the duel
19807 if (player && player->duel && player->duel->IsMounted)
19808 player->DuelComplete(DUEL_FLED);
19809
19810 Vehicle* vehicle = m_vehicle;
19811 Unit* vehicleBase = m_vehicle->GetBase();
19812 m_vehicle = nullptr;
19813
19814 if (!vehicleBase)
19815 return;
19816
19817 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
19818
19819 Position pos;
19820 // If we ask for a specific exit position, use that one. Otherwise allow scripts to modify it
19821 if (exitPosition)
19822 pos = *exitPosition;
19823 else
19824 {
19825 // Set exit position to vehicle position and use the current orientation
19826 pos = vehicleBase->GetPosition(); // This should use passenger's current position, leaving it as it is now
19827 pos.SetOrientation(vehicleBase->GetOrientation());
19828
19829 // Change exit position based on seat entry addon data
19830 if (seatAddon)
19831 {
19833 pos.RelocateOffset({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
19835 pos.Relocate({ seatAddon->ExitParameterX, seatAddon->ExitParameterY, seatAddon->ExitParameterZ, seatAddon->ExitParameterO });
19836 }
19837 }
19838
19840
19841 if (player)
19842 {
19844
19845 sScriptMgr->AnticheatSetUnderACKmount(player);
19846 }
19848 {
19850 data << GetPackGUID();
19851 SendMessageToSet(&data, false);
19852 }
19853
19854 // xinef: hack for flameleviathan seat vehicle
19855 VehicleEntry const* vehicleInfo = vehicle->GetVehicleInfo();
19856 if (!vehicleInfo || vehicleInfo->m_ID != 341)
19857 {
19858 Movement::MoveSplineInit init(this);
19859 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
19860 init.SetFacing(vehicleBase->GetOrientation());
19861 init.SetTransportExit();
19862 init.Launch();
19863 }
19864 else
19865 {
19866 float o = pos.GetAngle(this);
19867 Movement::MoveSplineInit init(this);
19868 init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
19869 init.SetFacing(GetOrientation());
19870 init.SetTransportExit();
19871 init.Launch();
19872 DisableSpline();
19873 KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f);
19875 }
19876
19877 // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest
19878 if (IsCreature() && !CanFly() && vehicleInfo && (vehicleInfo->m_ID == 113 || vehicleInfo->m_ID == 8 || vehicleInfo->m_ID == 290 || vehicleInfo->m_ID == 298))
19879 {
19881 }
19882
19883 if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
19884 if (((Minion*)vehicleBase)->GetOwner() == this)
19885 {
19886 if (!vehicleInfo || vehicleInfo->m_ID != 349)
19887 {
19888 vehicle->Dismiss();
19889 }
19890 else if (vehicleBase->IsCreature())
19891 {
19892 vehicle->Uninstall();
19893 vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000));
19894 }
19895
19896 // xinef: ugly hack, no appripriate hook later to cast spell
19897 if (player)
19898 {
19899 if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER)
19900 player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true);
19901 else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER)
19902 player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true);
19903 }
19904 }
19905
19907 {
19908 // Vehicle just died, we die too
19909 if (vehicleBase->getDeathState() == DeathState::JustDied)
19911 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
19912 else
19913 ToTempSummon()->UnSummon(2000); // Approximation
19914 }
19915
19916 if (player)
19917 {
19919 player->SetCanTeleport(true);
19920 }
19921}
@ DELAYED_VEHICLE_TELEPORT
Definition Player.h:914
@ DUEL_FLED
Definition SharedDefines.h:3614
@ MOVEMENTFLAG_ROOT
Definition UnitDefines.h:376
@ UNIT_MASK_ACCESSORY
Definition UnitDefines.h:165
@ UNIT_MASK_MINION
Definition UnitDefines.h:157
@ UNIT_STATE_ROOT
Definition UnitDefines.h:180
@ UNIT_STATE_MOVE
Definition UnitDefines.h:189
@ VEHICLE_SPELL_PARACHUTE
Definition VehicleDefines.h:53
@ VEHICLE_SPELL_SHADE_CONTROL_END
Definition VehicleDefines.h:56
@ VEHICLE_SPELL_GEIST_CONTROL_END
Definition VehicleDefines.h:55
@ NPC_EIDOLON_WATCHER
Definition VehicleDefines.h:69
@ NPC_LITHE_STALKER
Definition VehicleDefines.h:70
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition EventProcessor.h:103
uint64 CalculateTime(uint64 t_offset) const
Definition EventProcessor.cpp:159
Definition TemporarySummon.h:77
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:627
Definition MoveSplineInit.h:71
PackedGuid const & GetPackGUID() const
Definition Object.h:114
bool IsCreature() const
Definition Object.h:204
void SetCanTeleport(bool value)
Definition Player.h:2501
void DuelComplete(DuelCompleteType type)
Definition Player.cpp:6441
void SetFallInformation(uint32 time, float z)
Definition Player.h:2339
std::unique_ptr< DuelInfo > duel
Definition Player.h:1881
void ResummonPetTemporaryUnSummonedIfAny()
Definition Player.cpp:14265
uint32 GetDelayedOperations() const
Definition Player.h:2101
virtual void UnSummon(uint32 msTime=0)
Definition TemporarySummon.cpp:287
virtual void setDeathState(DeathState s, bool despawn=false)
Definition Unit.cpp:14576
Unit * GetOwner() const
Definition Unit.cpp:10623
DeathState getDeathState()
Definition Unit.h:1701
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition Unit.h:1670
TempSummon * ToTempSummon()
Definition Unit.h:702
void DisableSpline()
Definition Unit.cpp:636
void AddUnitState(uint32 f)
Definition Unit.h:706
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18057
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:742
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1167
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:712
void KnockbackFrom(float x, float y, float speedXY, float speedZ)
Definition Unit.cpp:19166
Definition Vehicle.h:101
Definition Vehicle.h:28
void Dismiss()
Definition Vehicle.cpp:538
VehicleEntry const * GetVehicleInfo() const
Definition Vehicle.h:38
void RemovePassenger(Unit *passenger)
Definition Vehicle.cpp:459
void Uninstall()
Definition Vehicle.cpp:100
VehicleSeatAddon const * GetSeatAddonForSeatOfPassenger(Unit const *passenger) const
Definition Vehicle.cpp:236
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:2091
EventProcessor m_Events
Definition Object.h:635
@ SMSG_SPLINE_MOVE_UNROOT
Definition Opcodes.h:802
Seconds GetGameTime()
Definition GameTime.cpp:38
Definition Position.h:27
void RelocateOffset(const Position &offset)
Definition Position.cpp:59
float GetPositionZ() const
Definition Position.h:118
float GetOrientation() const
Definition Position.h:119
void SetOrientation(float orientation)
Definition Position.h:111
float GetPositionX() const
Definition Position.h:116
void GetPosition(float &x, float &y) const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:117
float GetAngle(const Position *pos) const
Definition Position.cpp:78
Definition DBCStructure.h:2026
uint32 m_ID
Definition DBCStructure.h:2027
Definition VehicleDefines.h:86
float ExitParameterO
Definition VehicleDefines.h:96
float ExitParameterX
Definition VehicleDefines.h:93
float ExitParameterY
Definition VehicleDefines.h:94
float ExitParameterZ
Definition VehicleDefines.h:95
VehicleExitParameters ExitParameter
Definition VehicleDefines.h:97

References EventProcessor::AddEvent(), AddUnitState(), EventProcessor::CalculateTime(), CanFly(), CastSpell(), DELAYED_VEHICLE_TELEPORT, DisableSpline(), Vehicle::Dismiss(), Player::duel, DUEL_FLED, Player::DuelComplete(), VehicleSeatAddon::ExitParameter, VehicleSeatAddon::ExitParameterO, VehicleSeatAddon::ExitParameterX, VehicleSeatAddon::ExitParameterY, VehicleSeatAddon::ExitParameterZ, Position::GetAngle(), Vehicle::GetBase(), getDeathState(), Player::GetDelayedOperations(), Object::GetEntry(), GameTime::GetGameTime(), GetMotionMaster(), Position::GetOrientation(), GetOwner(), Object::GetPackGUID(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Vehicle::GetSeatAddonForSeatOfPassenger(), Vehicle::GetVehicleInfo(), HasUnitMovementFlag(), HasUnitTypeMask(), Object::IsCreature(), JustDied, KnockbackFrom(), Movement::MoveSplineInit::Launch(), WorldObject::m_Events, VehicleEntry::m_ID, m_vehicle, MotionMaster::MoveFall(), MOVEMENTFLAG_ROOT, Movement::MoveSplineInit::MoveTo(), NPC_EIDOLON_WATCHER, NPC_LITHE_STALKER, Position::Relocate(), Position::RelocateOffset(), Vehicle::RemovePassenger(), Player::ResummonPetTemporaryUnSummonedIfAny(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), SetControlled(), setDeathState(), Movement::MoveSplineInit::SetFacing(), Player::SetFallInformation(), Position::SetOrientation(), Movement::MoveSplineInit::SetTransportExit(), SMSG_SPLINE_MOVE_UNROOT, sScriptMgr, Object::ToPlayer(), ToTempSummon(), Vehicle::Uninstall(), UNIT_MASK_ACCESSORY, UNIT_MASK_MINION, UNIT_STATE_MOVE, UNIT_STATE_ROOT, TempSummon::UnSummon(), VEHICLE_SPELL_GEIST_CONTROL_END, VEHICLE_SPELL_PARACHUTE, VEHICLE_SPELL_SHADE_CONTROL_END, VehicleExitParamDest, and VehicleExitParamOffset.

Referenced by AuraEffect::HandleAuraControlVehicle(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ _IsNoStackAuraDueToAura()

bool Unit::_IsNoStackAuraDueToAura ( Aura appliedAura,
Aura existingAura 
) const

◆ _IsValidAssistTarget()

bool Unit::_IsValidAssistTarget ( Unit const *  target,
SpellInfo const *  bySpell 
) const
14024{
14025 ASSERT(target);
14026
14027 // can assist to self
14028 if (this == target)
14029 return true;
14030
14031 // can't assist unattackable units or GMs
14032 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
14033 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
14034 return false;
14035
14036 // can't assist own vehicle or passenger
14037 if (m_vehicle)
14038 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
14039 return false;
14040
14041 // can't assist invisible
14042 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
14043 return false;
14044
14045 // can't assist dead
14046 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
14047 return false;
14048
14049 // can't assist untargetable
14050 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
14051 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
14052 return false;
14053
14054 if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
14055 {
14056 // xinef: do not allow to assist non attackable units
14057 if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
14058 return false;
14059
14061 {
14062 if (target->IsImmuneToPC())
14063 return false;
14064 }
14065 else
14066 {
14067 if (target->IsImmuneToNPC())
14068 return false;
14069 }
14070 }
14071
14072 // can't assist non-friendly targets
14073 if (GetReactionTo(target) < REP_NEUTRAL
14074 && target->GetReactionTo(this) < REP_NEUTRAL
14075 && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)))
14076 return false;
14077
14078 // PvP case
14079 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
14080 {
14081 Player const* targetPlayerOwner = target->GetAffectingPlayer();
14083 {
14084 Player const* selfPlayerOwner = GetAffectingPlayer();
14085 if (selfPlayerOwner && targetPlayerOwner)
14086 {
14087 // can't assist player which is dueling someone
14088 if (selfPlayerOwner != targetPlayerOwner
14089 && targetPlayerOwner->duel)
14090 return false;
14091 }
14092 // can't assist player in ffa_pvp zone from outside
14093 if (target->IsFFAPvP() && !IsFFAPvP())
14094 return false;
14095
14096 // can't assist player out of sanctuary from sanctuary if has pvp enabled
14097 if (target->IsPvP())
14098 if (IsInSanctuary() && !target->IsInSanctuary())
14099 return false;
14100 }
14101 }
14102 // PvC case - player can assist creature only if has specific type flags
14103 // !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
14105 && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
14106 && !target->IsPvP())
14107 {
14108 if (Creature const* creatureTarget = target->ToCreature())
14109 return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST;
14110 }
14111 return true;
14112}
@ REP_NEUTRAL
Definition SharedDefines.h:183
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Definition SharedDefines.h:2721
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition SharedDefines.h:2707
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
Definition SharedDefines.h:628
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition SharedDefines.h:617
@ SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC
Definition SharedDefines.h:607
@ UNIT_STATE_UNATTACKABLE
Definition UnitDefines.h:207
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:251
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:275
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition UnitDefines.h:253
Definition Creature.h:43
Creature * ToCreature()
Definition Object.h:205
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition Unit.cpp:10087
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:718
bool IsInSanctuary() const
Definition Unit.h:986
bool IsFFAPvP() const
Definition Unit.h:988
Player * GetAffectingPlayer() const
Definition Unit.cpp:10648
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition Object.cpp:1737

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_CAN_ASSIST, CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, GetAffectingPlayer(), Vehicle::GetBase(), GetReactionTo(), SpellInfo::HasAttribute(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsImmuneToNPC(), IsImmuneToPC(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), m_vehicle, REP_NEUTRAL, SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_STATE_UNATTACKABLE.

Referenced by SpellInfo::CheckExplicitTarget(), IsValidAssistTarget(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _IsValidAttackTarget()

bool Unit::_IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell,
WorldObject const *  obj = nullptr 
) const
13901{
13902 ASSERT(target);
13903
13904 // can't attack self
13905 if (this == target)
13906 return false;
13907
13908 // can't attack unattackable units or GMs
13909 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13910 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
13911 return false;
13912
13913 // can't attack own vehicle or passenger
13914 if (m_vehicle)
13915 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13916 if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter
13917 return false;
13918
13919 // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
13920 //Ignore stealth if target is player and unit in combat with same player
13921 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->IsPlayer() && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
13922 return false;
13923
13924 // can't attack dead
13925 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13926 return false;
13927
13928 // can't attack untargetable
13929 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13930 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13931 return false;
13932
13933 if (Player const* playerAttacker = ToPlayer())
13934 {
13935 if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
13936 return false;
13937 }
13938 // check flags
13940 || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
13941 || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
13942 || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC())
13943 // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
13944 || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
13945 return false;
13946
13947 // CvC case - can attack each other only when one of them is hostile
13949 return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
13950
13951 // PvP, PvC, CvP case
13952 // can't attack friendly targets
13953 ReputationRank repThisToTarget = GetReactionTo(target);
13954 ReputationRank repTargetToThis;
13955
13956 if (repThisToTarget > REP_NEUTRAL
13957 || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL)
13958 return false;
13959
13960 // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
13961 if (repThisToTarget == REP_NEUTRAL &&
13962 repTargetToThis <= REP_NEUTRAL)
13963 {
13964 Player* owner = GetAffectingPlayer();
13965 Unit const* const thisUnit = owner ? owner : this;
13966 if (!(target->IsPlayer() && thisUnit->IsPlayer()) &&
13967 !(target->IsCreature() && thisUnit->IsCreature()))
13968 {
13969 Player const* player = target->IsPlayer() ? target->ToPlayer() : thisUnit->ToPlayer();
13970 Unit const* creature = target->IsCreature() ? target : thisUnit;
13971
13972 if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
13973 {
13974 if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
13975 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
13976 if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
13977 if (!(repState->Flags & FACTION_FLAG_AT_WAR))
13978 return false;
13979 }
13980 }
13981 }
13982
13983 Creature const* creatureAttacker = ToCreature();
13984 if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
13985 return false;
13986
13987 Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
13988 Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
13989
13990 // check duel - before sanctuary checks
13991 if (playerAffectingAttacker && playerAffectingTarget)
13992 if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->Opponent == playerAffectingTarget && playerAffectingAttacker->duel->State == DUEL_STATE_IN_PROGRESS)
13993 return true;
13994
13995 // PvP case - can't attack when attacker or target are in sanctuary
13996 // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
13997 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
13998 return false;
13999
14000 // additional checks - only PvP case
14001 if (playerAffectingAttacker && playerAffectingTarget)
14002 {
14003 if (!IsPvP() && bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK))
14004 return false;
14005
14006 if (target->IsPvP())
14007 return true;
14008
14009 if (IsFFAPvP() && target->IsFFAPvP())
14010 return true;
14011
14013 }
14014 return true;
14015}
@ FACTION_FLAG_AT_WAR
Definition DBCEnums.h:308
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ TYPEMASK_DYNAMICOBJECT
Definition ObjectGuid.h:52
@ TYPEMASK_GAMEOBJECT
Definition ObjectGuid.h:51
@ DUEL_STATE_IN_PROGRESS
Definition Player.h:377
@ PLAYER_FLAGS_UBER
Definition Player.h:498
@ SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK
Definition SharedDefines.h:573
ReputationRank
Definition SharedDefines.h:179
@ REP_HOSTILE
Definition SharedDefines.h:181
@ UNIT_BYTE2_FLAG_UNK1
Definition UnitDefines.h:137
@ UNIT_FLAG_TAXI_FLIGHT
Definition UnitDefines.h:270
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition UnitDefines.h:266
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition UnitDefines.h:257
#define WORLD_TRIGGER
Definition Unit.h:37
@ UNIT_FIELD_BYTES_2
Definition UpdateFields.h:161
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:205
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition Object.cpp:949
ReputationMgr & GetReputationMgr()
Definition Player.h:2128
FactionState const * GetState(FactionEntry const *factionEntry) const
Definition ReputationMgr.h:81
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition ReputationMgr.h:106
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:10057
bool IsPvP() const
Definition Unit.h:987
bool HasStealthAura() const
Definition Unit.h:1752
bool IsInCombatWith(Unit const *who) const
Definition Unit.cpp:21061
bool IsImmuneToNPC() const
Definition Unit.h:885
bool IsHostileTo(Unit const *unit) const
Definition Unit.cpp:10259
bool IsImmuneToPC() const
Definition Unit.h:883
bool IsInCombat() const
Definition Unit.h:890
uint32 type_flags
Definition CreatureData.h:223
Definition DBCStructure.h:906
Definition ReputationMgr.h:41
Definition DBCStructure.h:938

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_FLAG_AT_WAR, GetAffectingPlayer(), Vehicle::GetBase(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetReactionTo(), Player::GetReputationMgr(), ReputationMgr::GetState(), SpellInfo::HasAttribute(), Object::HasByteFlag(), HasStealthAura(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), Object::IsCreature(), IsFFAPvP(), Player::IsGameMaster(), IsHostileTo(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsInCombatWith(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), Object::isType(), m_vehicle, PLAYER_FLAGS_UBER, REP_HOSTILE, REP_NEUTRAL, sFactionStore, SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEMASK_DYNAMICOBJECT, TYPEMASK_GAMEOBJECT, UNIT_BYTE2_FLAG_UNK1, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NON_ATTACKABLE_2, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_TAXI_FLIGHT, UNIT_STATE_UNATTACKABLE, and WORLD_TRIGGER.

Referenced by SpellInfo::CheckExplicitTarget(), Spell::DoSpellHitOnUnit(), GetMagicHitRedirectTarget(), GetMeleeHitRedirectTarget(), IsValidAttackTarget(), Acore::AnyAoETargetUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect aurEff,
bool  apply 
)
4697{
4698 if (apply)
4699 m_modAuras[aurEff->GetAuraType()].push_back(aurEff);
4700 else
4701 m_modAuras[aurEff->GetAuraType()].remove(aurEff);
4702}
AuraType GetAuraType() const
Definition SpellAuraEffects.cpp:447
AuraEffectList m_modAuras[TOTAL_AURAS]
Definition Unit.h:2084

References AuraEffect::GetAuraType(), and m_modAuras.

Referenced by AuraEffect::HandleEffect().

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject dynObj)
6142{
6143 m_dynObj.push_back(dynObj);
6144}

References m_dynObj.

Referenced by DynamicObject::BindToCaster().

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )
5483{
5484 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5485 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
5486}

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_RemoveAllStatBonuses().

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit pAttacker)
inlineprivate
Note
: Call only in Unit::Attack()
2143{ m_attackers.erase(pAttacker); }

References m_attackers.

Referenced by Attack(), and AttackStop().

◆ _RemoveNoStackAuraApplicationsDueToAura()

void Unit::_RemoveNoStackAuraApplicationsDueToAura ( Aura aura)

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura aura)
4668{
4669 //SpellInfo const* spellProto = aura->GetSpellInfo();
4670
4671 // passive spell special case (only non stackable with ranks)
4672
4673 // xinef: this check makes caster to have 2 area auras thanks to spec switch
4674 // if (spellProto->IsPassiveStackableWithRanks())
4675 // return;
4676
4677 bool remove = false;
4678 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
4679 {
4680 if (remove)
4681 {
4682 remove = false;
4683 i = m_appliedAuras.begin();
4684 }
4685
4686 if (aura->CanStackWith(i->second->GetBase(), true))
4687 continue;
4688
4690 if (i == m_appliedAuras.end())
4691 break;
4692 remove = true;
4693 }
4694}
@ AURA_REMOVE_BY_DEFAULT
Definition SpellAuraDefines.h:392
bool CanStackWith(Aura const *checkAura, bool remove) const
Definition SpellAuras.cpp:2021
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4776

References AURA_REMOVE_BY_DEFAULT, Aura::CanStackWith(), m_appliedAuras, and RemoveAura().

Referenced by _AddAura(), and _ApplyAura().

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit caster,
int32 baseAmount = nullptr,
Item castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool  periodicReset = false 
)
4355{
4356 ASSERT(casterGUID || caster);
4357 if (!casterGUID)
4358 casterGUID = caster->GetGUID();
4359
4360 // Xinef: Hax for mixology, best solution qq
4361 if (sSpellMgr->GetSpellGroup(newAura->Id) == 1)
4362 return nullptr;
4363
4364 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
4365 if (!newAura->IsMultiSlotAura())
4366 {
4367 // check if cast item changed
4368 ObjectGuid castItemGUID;
4369 if (castItem)
4370 castItemGUID = castItem->GetGUID();
4371
4372 // find current aura from spell and change it's stackamount, or refresh it's duration
4373 if (Aura* foundAura = GetOwnedAura(newAura->Id, newAura->HasAttribute(SPELL_ATTR0_CU_SINGLE_AURA_STACK) ? ObjectGuid::Empty : casterGUID, newAura->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
4374 {
4375 // effect masks do not match
4376 // extremely rare case
4377 // let's just recreate aura
4378 if (effMask != foundAura->GetEffectMask())
4379 return nullptr;
4380
4381 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
4382 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4383 {
4384 if (!foundAura->HasEffect(i))
4385 continue;
4386
4387 int bp;
4388 if (baseAmount)
4389 bp = *(baseAmount + i);
4390 else
4391 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
4392
4393 int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
4394 *oldBP = bp;
4395 }
4396
4397 // correct cast item guid if needed
4398 if (castItemGUID != foundAura->GetCastItemGUID())
4399 {
4400 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
4401 *oldGUID = castItemGUID;
4402 }
4403
4404 // try to increase stack amount
4405 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, periodicReset);
4406 sScriptMgr->OnAuraApply(this, foundAura);
4407 return foundAura;
4408 }
4409 }
4410
4411 return nullptr;
4412}
std::int32_t int32
Definition Define.h:103
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition SpellInfo.h:176
@ SPELL_ATTR0_CU_SINGLE_AURA_STACK
Definition SpellInfo.h:198
#define sSpellMgr
Definition SpellMgr.h:825
Definition ObjectGuid.h:118
static ObjectGuid const Empty
Definition ObjectGuid.h:120
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
Definition Unit.cpp:4760

References ASSERT, AURA_REMOVE_BY_DEFAULT, ObjectGuid::Empty, Object::GetGUID(), GetOwnedAura(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsMultiSlotAura(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR0_CU_SINGLE_AURA_STACK, sScriptMgr, and sSpellMgr.

Referenced by Aura::TryRefreshStackOrCreate().

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication aurApp,
AuraRemoveMode  removeMode 
)
4647{
4648 // aura can be removed from unit only if it's applied on it, shouldn't happen
4649 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
4650
4651 uint32 spellId = aurApp->GetBase()->GetId();
4652 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4653
4654 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4655 {
4656 if (iter->second == aurApp)
4657 {
4658 _UnapplyAura(iter, removeMode);
4659 return;
4660 }
4661 else
4662 ++iter;
4663 }
4664 ABORT();
4665}
#define ABORT
Definition Errors.h:76
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition Unit.h:647
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition Unit.cpp:4551

References _UnapplyAura(), ABORT, ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), and m_appliedAuras.

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)
4552{
4553 AuraApplication* aurApp = i->second;
4554 ASSERT(aurApp);
4555 ASSERT(!aurApp->GetRemoveMode());
4556 ASSERT(aurApp->GetTarget() == this);
4557
4558 aurApp->SetRemoveMode(removeMode);
4559 Aura* aura = aurApp->GetBase();
4560 LOG_DEBUG("spells.aura", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
4561
4562 // dead loop is killing the server probably
4563 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
4564
4566
4567 Unit* caster = aura->GetCaster();
4568
4569 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
4570 m_appliedAuras.erase(i);
4571
4572 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4573 // xinef: event if it gets removed, it will be reapplied in a second
4574 if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner())
4575 {
4576 m_interruptableAuras.remove(aurApp);
4578 }
4579
4580 bool auraStateFound = false;
4581 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
4582 if (auraState)
4583 {
4584 bool canBreak = false;
4585 // Get mask of all aurastates from remaining auras
4586 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
4587 {
4588 if (itr->second == aurApp)
4589 {
4590 m_auraStateAuras.erase(itr);
4591 itr = m_auraStateAuras.lower_bound(auraState);
4592 canBreak = true;
4593 continue;
4594 }
4595 auraStateFound = true;
4596 ++itr;
4597 }
4598 }
4599
4600 aurApp->_Remove();
4601 aura->_UnapplyForTarget(this, caster, aurApp);
4602
4603 // remove effects of the spell - needs to be done after removing aura from lists
4604 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4605 {
4606 if (aurApp->HasEffect(itr))
4607 aurApp->_HandleEffect(itr, false);
4608 }
4609
4610 // all effect mustn't be applied
4611 ASSERT(!aurApp->GetEffectMask());
4612
4613 // Remove totem at next update if totem loses its aura
4614 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
4615 {
4616 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
4618 }
4619
4620 // Remove aurastates only if needed and were not found
4621 if (auraState)
4622 {
4623 if (!auraStateFound)
4624 ModifyAuraState(auraState, false);
4625 else
4626 {
4627 // update for casters, some shouldn't 'see' the aura state
4628 uint32 aStateMask = (1 << (auraState - 1));
4629 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) != 0)
4631 }
4632 }
4633
4634 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
4635
4636 // only way correctly remove all auras from list
4637 //if (removedAuras != m_removedAurasCount) new aura may be added
4638 i = m_appliedAuras.begin();
4639
4640 sScriptMgr->OnAuraRemove(this, aurApp, removeMode);
4641
4642 if (this->ToCreature() && this->ToCreature()->IsAIEnabled)
4643 this->ToCreature()->AI()->OnAuraRemove(aurApp, removeMode);
4644}
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
@ TOTEM_PASSIVE
Definition Totem.h:25
Unit * GetTarget() const
Definition SpellAuras.h:61
void SetRemoveMode(AuraRemoveMode mode)
Definition SpellAuras.h:72
void _Remove()
Definition SpellAuras.cpp:94
bool HasEffect(uint8 effect) const
Definition SpellAuras.h:67
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition SpellAuras.cpp:515
virtual void OnAuraRemove(AuraApplication *, AuraRemoveMode)
Definition CreatureAI.h:225
CreatureAI * AI() const
Definition Creature.h:140
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition TemporarySummon.cpp:400
Totem * ToTotem()
Definition Unit.h:701
void UpdateInterruptMask()
Definition Unit.cpp:754
bool IsTotem() const
Definition Unit.h:762

References AuraApplication::_HandleEffect(), AuraApplication::_Remove(), Aura::_UnapplyForTarget(), Creature::AI(), ASSERT, AURA_REMOVE_BY_EXPIRE, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Aura::GetCasterGUID(), AuraApplication::GetEffectMask(), Object::GetGUID(), Aura::GetId(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), AuraApplication::HasEffect(), IsAIEnabled, IsTotem(), JustDied, LOG_DEBUG, m_appliedAuras, m_auraStateAuras, m_interruptableAuras, m_removedAurasCount, MAX_SPELL_EFFECTS, ModifyAuraState(), CreatureAI::OnAuraRemove(), PER_CASTER_AURA_STATE_MASK, Minion::setDeathState(), AuraApplication::SetRemoveMode(), sScriptMgr, Object::ToCreature(), TOTEM_PASSIVE, ToTotem(), UNIT_FIELD_AURASTATE, and UpdateInterruptMask().

Referenced by Aura::_Remove(), _UnapplyAura(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAura(), and RemoveEvadeAuras().

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject dynObj)
6147{
6148 m_dynObj.remove(dynObj);
6149}

References m_dynObj.

Referenced by DynamicObject::UnbindFromCaster().

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected
3903{
3904 SpellInfo const* spellProto = nullptr;
3906 {
3908 }
3909
3910 if (!spellProto)
3911 {
3912 return;
3913 }
3914
3915 static uint32 const HUNTER_AUTOSHOOT = 75;
3916
3917 // Check "realtime" interrupts
3918 if ((IsPlayer() && ToPlayer()->isMoving()) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT))
3919 {
3920 // cancel wand shoot
3921 if (spellProto->Id != HUNTER_AUTOSHOOT)
3923 m_AutoRepeatFirstCast = true;
3924 return;
3925 }
3926
3928 {
3930 }
3931
3932 m_AutoRepeatFirstCast = false;
3933
3934 // Check for ranged attack timer
3936 {
3938 if (result != SPELL_CAST_OK)
3939 {
3940 if (spellProto->Id != HUNTER_AUTOSHOOT)
3941 {
3943 }
3944
3945 return;
3946 }
3947
3948 // We want to shoot
3949 Spell* spell = new Spell(this, spellProto, TRIGGERED_FULL_MASK);
3950 spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
3951
3952 // Reset attack
3954 }
3955}
SpellCastResult
Definition SharedDefines.h:948
@ SPELL_CAST_OK
Definition SharedDefines.h:1138
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition SpellDefines.h:150
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:540
Definition Spell.h:287
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition Spell.cpp:3480
SpellCastResult CheckCast(bool strict)
Definition Spell.cpp:5658
SpellInfo const *const m_spellInfo
Definition Spell.h:523
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4060
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4099
void setAttackTimer(WeaponAttackType type, int32 time)
Definition Unit.h:841
bool isMoving() const
Definition Unit.h:1625
int32 getAttackTimer(WeaponAttackType type) const
Definition Unit.h:843
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition Unit.h:844
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition Unit.cpp:642

References Spell::CheckCast(), CURRENT_AUTOREPEAT_SPELL, getAttackTimer(), SpellInfo::Id, InterruptSpell(), isAttackReady(), isMoving(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_spellInfo, Spell::prepare(), RANGED_ATTACK, resetAttackTimer(), setAttackTimer(), SPELL_CAST_OK, Object::ToPlayer(), and TRIGGERED_FULL_MASK.

Referenced by _UpdateSpells().

◆ _UpdateSpells()

void Unit::_UpdateSpells ( uint32  time)
protected
3845{
3848
3849 // remove finished spells from current pointers
3850 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
3851 {
3852 if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
3853 {
3855 m_currentSpells[i] = nullptr; // remove pointer
3856 }
3857 }
3858
3859 // m_auraUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
3861 {
3862 Aura* i_aura = m_auraUpdateIterator->second;
3863 ++m_auraUpdateIterator; // need shift to next for allow update if need into aura update
3864 i_aura->UpdateOwner(time, this);
3865 }
3866
3867 // remove expired auras - do that after updates(used in scripts?)
3868 for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
3869 {
3870 if (i->second->IsExpired())
3872 else if (i->second->GetSpellInfo()->IsChanneled() && i->second->GetCasterGUID() != GetGUID() && !ObjectAccessor::GetWorldObject(*this, i->second->GetCasterGUID()))
3873 RemoveOwnedAura(i, AURA_REMOVE_BY_CANCEL); // remove channeled auras when caster is not on the same map
3874 else
3875 ++i;
3876 }
3877
3878 for (VisibleAuraMap::iterator itr = m_visibleAuras.begin(); itr != m_visibleAuras.end(); ++itr)
3879 if (itr->second->IsNeedClientUpdate())
3880 itr->second->ClientUpdate();
3881
3883
3884 if (!m_gameObj.empty())
3885 {
3886 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
3887 {
3888 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
3889 if (!go->isSpawned())
3890 {
3891 go->SetOwnerGUID(ObjectGuid::Empty);
3892 go->SetRespawnTime(0);
3893 go->Delete();
3894 m_gameObj.erase(itr++);
3895 continue;
3896 }
3897 ++itr;
3898 }
3899 }
3900}
@ AURA_REMOVE_BY_CANCEL
Definition SpellAuraDefines.h:393
@ SPELL_STATE_FINISHED
Definition Spell.h:229
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition SpellAuras.cpp:756
Definition GameObject.h:120
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4705
void _UpdateAutoRepeatSpell()
Definition Unit.cpp:3902
VisibleAuraMap m_visibleAuras
Definition Unit.h:2093
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition ObjectAccessor.cpp:184
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const guid)
Definition ObjectAccessor.cpp:115

References _DeleteRemovedAuras(), _UpdateAutoRepeatSpell(), AURA_REMOVE_BY_CANCEL, AURA_REMOVE_BY_EXPIRE, CURRENT_AUTOREPEAT_SPELL, CURRENT_MAX_SPELL, ObjectGuid::Empty, ObjectAccessor::GetGameObject(), Object::GetGUID(), ObjectAccessor::GetWorldObject(), m_auraUpdateIterator, m_currentSpells, m_gameObj, m_ownedAuras, m_visibleAuras, RemoveOwnedAura(), Spell::SetReferencedFromCurrent(), SPELL_STATE_FINISHED, and Aura::UpdateOwner().

Referenced by Update().

◆ AddAura() [1/2]

Aura * Unit::AddAura ( SpellInfo const *  spellInfo,
uint8  effMask,
Unit target 
)
18902{
18903 if (!spellInfo)
18904 return nullptr;
18905
18906 if (target->IsImmunedToSpell(spellInfo))
18907 return nullptr;
18908
18909 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
18910 {
18911 if (!(effMask & (1 << i)))
18912 continue;
18913 if (target->IsImmunedToSpellEffect(spellInfo, i))
18914 effMask &= ~(1 << i);
18915 }
18916
18917 if (Aura* aura = Aura::TryRefreshStackOrCreate(spellInfo, effMask, target, this))
18918 {
18919 aura->ApplyForTargets();
18920 return aura;
18921 }
18922 return nullptr;
18923}
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
Definition SpellAuras.cpp:326
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition Unit.cpp:13029
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition Unit.cpp:12939

References Aura::ApplyForTargets(), IsImmunedToSpell(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, and Aura::TryRefreshStackOrCreate().

◆ AddAura() [2/2]

Aura * Unit::AddAura ( uint32  spellId,
Unit target 
)
18887{
18888 if (!target)
18889 return nullptr;
18890
18891 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
18892 if (!spellInfo)
18893 return nullptr;
18894
18895 if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
18896 return nullptr;
18897
18898 return AddAura(spellInfo, MAX_EFFECT_MASK, target);
18899}
#define MAX_EFFECT_MASK
Definition DBCStructure.h:1637
@ SPELL_ATTR2_ALLOW_DEAD_TARGET
Definition SharedDefines.h:456
@ SPELL_ATTR0_PASSIVE
Definition SharedDefines.h:388
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:415
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:18886

References AddAura(), SpellInfo::HasAttribute(), IsAlive(), MAX_EFFECT_MASK, SPELL_ATTR0_PASSIVE, SPELL_ATTR2_ALLOW_DEAD_TARGET, and sSpellMgr.

Referenced by AddAura(), boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::AttackStart(), boss_anzu::boss_anzu(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoTriggersOnSpellHit(), npc_anubisath_sentinel::aqsentinelAI::GainSentinelAbility(), AuraEffect::HandleAuraDummy(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterAdd(), gm_commandscript::HandleGMVisibleCommand(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_transitus_shield_beam_aura::HandleOnEffectApply(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Guardian::InitStatsForLevel(), boss_gahzranka::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), npc_dalaran_warrior::npc_dalaran_warriorAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Creature::LoadCreaturesAddon(), npc_brew_bubble::MoveInLineOfSight(), npc_pet_gen_plump_turkey::MovementInform(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_empowered_aura::OnPeriodic(), instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), AreaTrigger_at_area_52_entrance::OnTrigger(), Player::ProcessDelayedOperations(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_corrupted_totem::Reset(), npc_troll_volunteer::npc_troll_volunteerAI::Reset(), npc_vengeful_shade::npc_vengeful_shadeAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_magus_telestra::Reset(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_archavon::boss_archavonAI::Reset(), boss_emalon::boss_emalonAI::Reset(), boss_koralon::boss_koralonAI::Reset(), boss_toravon::boss_toravonAI::Reset(), npc_dalaran_mage::npc_dalaran_mageAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), npc_pet_pri_shadowfiend::Reset(), Player::SendInitialPacketsAfterAddToMap(), npc_corrupted_totem::SetAura(), SetAuraStack(), Player::SetGMVisible(), Player::SetIsSpectator(), npc_artorius::npc_artoriusAI::SpellHit(), npc_simone::npc_simoneAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::SpellHitTarget(), boss_netherspite::SwitchToPortalPhase(), boss_gyth::boss_gythAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), boss_netherspite::UpdatePortals(), and npc_emily::npc_emilyAI::WaypointReached().

◆ AddComboPointHolder()

void Unit::AddComboPointHolder ( Unit unit)
inline
973{ m_ComboPointHolders.insert(unit); }
std::unordered_set< Unit * > m_ComboPointHolders
Definition Unit.h:2159

References m_ComboPointHolders.

Referenced by AddComboPoints().

◆ AddComboPoints() [1/2]

void Unit::AddComboPoints ( int8  count)
inline
970{ AddComboPoints(nullptr, count); }
void AddComboPoints(Unit *target, int8 count)
Definition Unit.cpp:16861

References AddComboPoints().

Referenced by AddComboPoints().

◆ AddComboPoints() [2/2]

void Unit::AddComboPoints ( Unit target,
int8  count 
)
16862{
16863 if (!count)
16864 {
16865 return;
16866 }
16867
16868 if (target && target != m_comboTarget)
16869 {
16870 if (m_comboTarget)
16871 {
16873 }
16874
16875 m_comboTarget = target;
16876 m_comboPoints = count;
16877 target->AddComboPointHolder(this);
16878 }
16879 else
16880 {
16881 m_comboPoints = std::max<int8>(std::min<int8>(m_comboPoints + count, 5), 0);
16882 }
16883
16885}
void SendComboPoints()
Definition Unit.cpp:16904
void AddComboPointHolder(Unit *unit)
Definition Unit.h:973
void RemoveComboPointHolder(Unit *unit)
Definition Unit.h:974

References AddComboPointHolder(), m_comboPoints, m_comboTarget, RemoveComboPointHolder(), and SendComboPoints().

Referenced by Spell::_handle_finish_phase(), AuraEffect::HandleAuraRetainComboPoints(), and ProcDamageAndSpellFor().

◆ AddExtraAttacks()

void Unit::AddExtraAttacks ( uint32  count)
2766{
2768 if (!targetGUID)
2769 {
2770 if (ObjectGuid selection = GetTarget())
2771 {
2772 targetGUID = selection; // Spell was cast directly (not triggered by aura)
2773 }
2774 else
2775 return;
2776 }
2777
2778 extraAttacksTargets[targetGUID] += count;
2779}
std::unordered_map< ObjectGuid, uint32 > extraAttacksTargets
Definition Unit.h:2170
ObjectGuid _lastDamagedTargetGuid
Definition Unit.h:2171
ObjectGuid GetTarget() const
Definition Unit.h:824

References _lastDamagedTargetGuid, extraAttacksTargets, and GetTarget().

Referenced by Spell::EffectAddExtraAttacks().

◆ AddExtraUnitMovementFlag()

void Unit::AddExtraUnitMovementFlag ( uint16  f)
inline
746{ m_movementInfo.flags2 |= f; }
MovementInfo m_movementInfo
Definition Object.h:607
uint16 flags2
Definition Object.h:285

References MovementInfo::flags2, and WorldObject::m_movementInfo.

Referenced by Vehicle::InitMovementInfoForBase().

◆ addFollower()

void Unit::addFollower ( FollowerReference pRef)
inline
void insertFirst(LinkedListElement *pElem)
Definition LinkedList.h:105
FollowerRefMgr m_FollowingRefMgr
Definition Unit.h:2155

References LinkedListHead::insertFirst(), and m_FollowingRefMgr.

Referenced by FollowerReference::targetObjectBuildLink().

◆ AddGameObject()

void Unit::AddGameObject ( GameObject gameObj)
6203{
6204 if (!gameObj || gameObj->GetOwnerGUID())
6205 return;
6206
6207 m_gameObj.push_back(gameObj->GetGUID());
6208 gameObj->SetOwnerGUID(GetGUID());
6209
6210 if (IsPlayer() && gameObj->GetSpellId())
6211 {
6212 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
6213 // Need disable spell use for owner
6214 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6215 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6216 ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true);
6217 }
6218}
uint32 GetSpellId() const
Definition GameObject.h:181
void SetOwnerGUID(ObjectGuid owner)
Definition GameObject.h:163
ObjectGuid GetOwnerGUID() const
Definition GameObject.h:173
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition Player.cpp:10942
bool IsCooldownStartedOnEvent() const
Definition SpellInfo.cpp:1212

References Player::AddSpellAndCategoryCooldowns(), Object::GetGUID(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, GameObject::SetOwnerGUID(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectTransmitted(), npc_midsummer_bonfire::Ignite(), and WorldObject::SummonGameObject().

◆ addHatedBy()

void Unit::addHatedBy ( HostileReference pHostileReference)
inline

◆ AddInterruptMask()

void Unit::AddInterruptMask ( uint32  mask)
inline
1526{ m_interruptMask |= mask; }

References m_interruptMask.

Referenced by _CreateAuraApplication(), and Spell::handle_immediate().

◆ AddPetAura()

void Unit::AddPetAura ( PetAura const *  petSpell)
17321{
17322 if (!IsPlayer())
17323 return;
17324
17325 m_petAuras.insert(petSpell);
17326 if (Pet* pet = ToPlayer()->GetPet())
17327 pet->CastPetAura(petSpell);
17328 else if (Unit* charm = GetCharm())
17329 charm->CastPetAura(petSpell);
17330}
Definition Pet.h:41
Unit * GetCharm() const
Definition Unit.cpp:10694
PetAuraSet m_petAuras
Definition Unit.h:2010
Pet * GetPet(WorldObject const &, ObjectGuid const guid)
Definition ObjectAccessor.cpp:215

References GetCharm(), Object::IsPlayer(), m_petAuras, and Object::ToPlayer().

Referenced by Spell::EffectDummy(), and AuraEffect::HandleAuraDummy().

◆ AddPlayerToVision()

void Unit::AddPlayerToVision ( Player player)
11193{
11194 if (m_sharedVision.empty())
11195 {
11196 setActive(true);
11197 SetWorldObject(true);
11198 }
11199 m_sharedVision.push_back(player);
11200 player->m_isInSharedVisionOf.insert(this);
11201}
void SetWorldObject(bool apply)
Definition Object.cpp:1075
void setActive(bool isActiveObject)
Definition Object.cpp:1094

References Player::m_isInSharedVisionOf, m_sharedVision, WorldObject::setActive(), and WorldObject::SetWorldObject().

◆ AddPointedBy()

void Unit::AddPointedBy ( SafeUnitPointer sup)
inline
1934{ SafeUnitPointerSet.insert(sup); }
std::set< SafeUnitPointer * > SafeUnitPointerSet
Definition Unit.h:2019

References SafeUnitPointerSet.

Referenced by SafeUnitPointer::SetPointedTo().

◆ AddSpellCooldown()

virtual void Unit::AddSpellCooldown ( uint32  ,
uint32  ,
uint32  ,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
inlinevirtual

◆ AddThreat()

void Unit::AddThreat ( Unit victim,
float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
14677{
14678 // Only mobs can manage threat lists
14680 {
14681 m_ThreatMgr.AddThreat(victim, fThreat, schoolMask, threatSpell);
14682 }
14683}
@ UNIT_STATE_EVADE
Definition UnitDefines.h:191
void AddThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition ThreatMgr.cpp:436
bool HasUnitState(const uint32 f) const
Definition Unit.h:707
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition Unit.cpp:14637

References ThreatMgr::AddThreat(), CanHaveThreatList(), HasUnitState(), m_ThreatMgr, and UNIT_STATE_EVADE.

Referenced by Attack(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), boss_shade_of_aran::AttackStart(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::AttackStart(), npc_capernian::AttackStart(), npc_dirt_mound::ChaseNewTarget(), boss_buru::ChaseNewVictim(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DamageTaken(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), DealDamage(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), CreatureAI::DoZoneInCombat(), Spell::EffectThreat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), npc_raging_flames::FixateRandomTarget(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), spell_morogrim_tidewalker_water_globule_new_target::HandleDummy(), HandleDummyAuraProc(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_pursue::HandleScript(), Spell::HandleThreatSpells(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_tiger_matriarch::npc_tiger_matriarchAI::IsSummonedBy(), npc_little_ooze::npc_little_oozeAI::IsSummonedBy(), npc_malchezaar_axe::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_buru::JustEngagedWith(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_curator::JustSummoned(), boss_sacrolash::JustSummoned(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustSummoned(), npc_akama_illidan::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), boss_shade_of_akama::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_mage_mirror_image::MySelectNextTarget(), SmartScript::ProcessAction(), RemoveCharmedBy(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), boss_skarvald_the_constructor::Reset(), boss_dalronn_the_controller::Reset(), npc_pet_hunter_snake_trap::Reset(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_romulo::ScheduleCombat(), npc_thaladred::ScheduleEvents(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), boss_supremus::SchedulePhase(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), and npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI().

◆ AddToWorld()

void Unit::AddToWorld ( )
overridevirtual

Reimplemented from Object.

15712{
15713 if (!IsInWorld())
15714 {
15716 }
15717}
void AddToWorld() override
Definition Object.cpp:1187

References WorldObject::AddToWorld(), and Object::IsInWorld().

Referenced by Creature::AddToWorld(), Pet::AddToWorld(), and Player::AddToWorld().

◆ AddUnitMovementFlag()

◆ AddUnitState()

void Unit::AddUnitState ( uint32  f)
inline
706{ m_state |= f; }

References m_state.

Referenced by _ExitVehicle(), RandomMovementGenerator< T >::_setRandomLocation(), MotionTransport::AddPassenger(), Attack(), boss_prince_keleseth_icc::boss_prince_kelesethAI::boss_prince_kelesethAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::boss_prince_taldaramAI(), boss_prince_valanar_icc::boss_prince_valanarAI::boss_prince_valanarAI(), Creature::Create(), MotionTransport::CreateNPCPassenger(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), boss_nightbane::DoAction(), WaypointMovementGenerator< Creature >::DoInitialize(), RandomMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoReset(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_jindo::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), Creature::FocusTarget(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetCastSpellOpcode(), RotateMovementGenerator::Initialize(), DistractMovementGenerator::Initialize(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), Player::LoadFromDB(), boss_ayamiss::MovementInform(), boss_lady_vashj::MovementInform(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pet_gen_wind_rider_cub::npc_pet_gen_wind_rider_cub(), npc_corrupted_totem::Reset(), boss_jedoga_shadowseeker::Reset(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), boss_hungarfen::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), SetCharmedBy(), SetContestedPvP(), SetControlled(), SetCurrentCastedSpell(), Player::setDeathState(), Player::SetIsSpectator(), boss_urom::boss_uromAI::SpellHit(), WaypointMovementGenerator< Creature >::StartMove(), npc_madrigosa::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), and boss_svala::boss_svalaAI::UpdateAI().

◆ AddUnitTypeMask()

void Unit::AddUnitTypeMask ( uint32  mask)
inline
713{ m_unitTypeMask |= mask; }

References m_unitTypeMask.

◆ ApplyAttackTimePercentMod()

void Unit::ApplyAttackTimePercentMod ( WeaponAttackType  att,
float  val,
bool  apply 
)
17078{
17079 float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
17080 if (val > 0)
17081 {
17083 ApplyPercentModFloatValue(static_cast<uint16>(UNIT_FIELD_BASEATTACKTIME) + att, val, !apply);
17084 }
17085 else
17086 {
17088 ApplyPercentModFloatValue(static_cast<uint16>(UNIT_FIELD_BASEATTACKTIME) + att, -val, apply);
17089 }
17090 m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
17091}
std::uint16_t uint16
Definition Define.h:108
@ UNIT_FIELD_BASEATTACKTIME
Definition UpdateFields.h:120
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition Util.h:50
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:829
uint32 GetAttackTime(WeaponAttackType att) const
Definition Unit.h:870

References Object::ApplyPercentModFloatValue(), ApplyPercentModFloatVar(), GetAttackTime(), m_attackTimer, m_modAttackSpeedPct, and UNIT_FIELD_BASEATTACKTIME.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleAuraModRangedHaste(), AuraEffect::HandleModAttackSpeed(), AuraEffect::HandleModCombatSpeedPct(), AuraEffect::HandleModMeleeRangedSpeedPct(), AuraEffect::HandleModMeleeSpeedPct(), and AuraEffect::HandleRangedAmmoHaste().

◆ ApplyCastTimePercentMod()

void Unit::ApplyCastTimePercentMod ( float  val,
bool  apply 
)
17094{
17095 if (val > 0)
17097 else
17099}
@ UNIT_MOD_CAST_SPEED
Definition UpdateFields.h:137

References Object::ApplyPercentModFloatValue(), and UNIT_MOD_CAST_SPEED.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleModCastingSpeed(), and AuraEffect::HandleModCombatSpeedPct().

◆ ApplyDiminishingAura()

void Unit::ApplyDiminishingAura ( DiminishingGroup  group,
bool  apply 
)
15150{
15151 // Checking for existing in the table
15152 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
15153 {
15154 if (i->DRGroup != group)
15155 continue;
15156
15157 if (apply)
15158 i->stack += 1;
15159 else if (i->stack)
15160 {
15161 i->stack -= 1;
15162 // Remember time after last aura from group removed
15163 if (i->stack == 0)
15164 i->hitTime = GameTime::GetGameTimeMS().count();
15165 }
15166 break;
15167 }
15168}
Diminishing m_Diminishing
Definition Unit.h:2151
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:43

References GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by UnitAura::_ApplyForTarget(), and UnitAura::_UnapplyForTarget().

◆ ApplyDiminishingToDuration()

float Unit::ApplyDiminishingToDuration ( DiminishingGroup  group,
int32 duration,
Unit caster,
DiminishingLevels  Level,
int32  limitduration 
)
15071{
15072 // xinef: dont apply diminish to self casts
15073 if (duration == -1 || group == DIMINISHING_NONE)
15074 return 1.0f;
15075
15076 // test pet/charm masters instead pets/charmeds
15077 Unit const* targetOwner = GetOwner();
15078 Unit const* casterOwner = caster->GetOwner();
15079
15080 // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)
15081 if (limitduration > 0 && duration > limitduration)
15082 {
15083 Unit const* target = targetOwner ? targetOwner : this;
15084 Unit const* source = casterOwner ? casterOwner : caster;
15085
15086 if ((target->IsPlayer()
15088 && source->IsPlayer())
15089 duration = limitduration;
15090 }
15091
15092 float mod = 1.0f;
15093
15094 if (group == DIMINISHING_TAUNT)
15095 {
15096 if (IsCreature() && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS))
15097 {
15098 DiminishingLevels diminish = Level;
15099 switch (diminish)
15100 {
15102 break;
15104 mod = 0.65f;
15105 break;
15107 mod = 0.4225f;
15108 break;
15110 mod = 0.274625f;
15111 break;
15113 mod = 0.0f;
15114 break;
15115 default:
15116 break;
15117 }
15118 }
15119 }
15120 // Some diminishings applies to mobs too (for example, Stun)
15122 && ((targetOwner ? (targetOwner->IsPlayer()) : (IsPlayer()))
15123 || (IsCreature() && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
15125 {
15126 DiminishingLevels diminish = Level;
15127 switch (diminish)
15128 {
15130 break;
15132 mod = 0.5f;
15133 break;
15135 mod = 0.25f;
15136 break;
15138 mod = 0.0f;
15139 break;
15140 default:
15141 break;
15142 }
15143 }
15144
15145 duration = int32(duration * mod);
15146 return mod;
15147}
@ CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS
Definition CreatureData.h:64
@ CREATURE_FLAG_EXTRA_ALL_DIMINISH
Definition CreatureData.h:65
@ DIMINISHING_NONE
Definition SharedDefines.h:3258
@ DIMINISHING_TAUNT
Definition SharedDefines.h:3276
@ DRTYPE_PLAYER
Definition SharedDefines.h:3251
@ DRTYPE_ALL
Definition SharedDefines.h:3252
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
Definition SpellMgr.cpp:245
DiminishingLevels
Definition Unit.h:262
@ DIMINISHING_LEVEL_3
Definition Unit.h:265
@ DIMINISHING_LEVEL_1
Definition Unit.h:263
@ DIMINISHING_LEVEL_4
Definition Unit.h:267
@ DIMINISHING_LEVEL_IMMUNE
Definition Unit.h:266
@ DIMINISHING_LEVEL_TAUNT_IMMUNE
Definition Unit.h:268
@ DIMINISHING_LEVEL_2
Definition Unit.h:264
uint32 flags_extra
Definition CreatureData.h:246

References CREATURE_FLAG_EXTRA_ALL_DIMINISH, CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS, DIMINISHING_LEVEL_1, DIMINISHING_LEVEL_2, DIMINISHING_LEVEL_3, DIMINISHING_LEVEL_4, DIMINISHING_LEVEL_IMMUNE, DIMINISHING_LEVEL_TAUNT_IMMUNE, DIMINISHING_NONE, DIMINISHING_TAUNT, DRTYPE_ALL, DRTYPE_PLAYER, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetDiminishingReturnsGroupType(), GetOwner(), Object::IsCreature(), Object::IsPlayer(), and Object::ToCreature().

Referenced by Spell::DoSpellHitOnUnit().

◆ ApplyEffectModifiers()

float Unit::ApplyEffectModifiers ( SpellInfo const *  spellProto,
uint8  effect_index,
float  value 
) const
14853{
14854 if (Player* modOwner = GetSpellModOwner())
14855 {
14856 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
14857 switch (effect_index)
14858 {
14859 case 0:
14860 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
14861 break;
14862 case 1:
14863 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
14864 break;
14865 case 2:
14866 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
14867 break;
14868 }
14869 }
14870 return value;
14871}
@ SPELLMOD_EFFECT2
Definition SpellDefines.h:88
@ SPELLMOD_ALL_EFFECTS
Definition SpellDefines.h:84
@ SPELLMOD_EFFECT3
Definition SpellDefines.h:99
@ SPELLMOD_EFFECT1
Definition SpellDefines.h:79
Player * GetSpellModOwner() const
Definition Unit.cpp:16600

References GetSpellModOwner(), SpellInfo::Id, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, and SPELLMOD_EFFECT3.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellEffectInfo::CalcValue(), and Spell::EffectSchoolDMG().

◆ ApplyResilience()

void Unit::ApplyResilience ( Unit const *  victim,
float *  crit,
int32 damage,
bool  isCrit,
CombatRating  type 
)
static
18951{
18952 // player mounted on multi-passenger mount is also classified as vehicle
18953 if (victim->IsVehicle() && !victim->IsPlayer())
18954 return;
18955
18956 Unit const* target = nullptr;
18957 if (victim->IsPlayer())
18958 target = victim;
18959 else if (victim->IsCreature())
18960 {
18961 if (Unit* owner = victim->GetOwner())
18962 if (owner->IsPlayer())
18963 target = owner;
18964 }
18965
18966 if (!target)
18967 return;
18968
18969 switch (type)
18970 {
18972 // Crit chance reduction works against nonpets
18973 if (crit)
18974 *crit -= target->GetMeleeCritChanceReduction();
18975 if (damage)
18976 {
18977 if (isCrit)
18978 *damage -= target->GetMeleeCritDamageReduction(*damage);
18979 *damage -= target->GetMeleeDamageReduction(*damage);
18980 }
18981 break;
18983 // Crit chance reduction works against nonpets
18984 if (crit)
18985 *crit -= target->GetRangedCritChanceReduction();
18986 if (damage)
18987 {
18988 if (isCrit)
18989 *damage -= target->GetRangedCritDamageReduction(*damage);
18990 *damage -= target->GetRangedDamageReduction(*damage);
18991 }
18992 break;
18994 // Crit chance reduction works against nonpets
18995 if (crit)
18996 *crit -= target->GetSpellCritChanceReduction();
18997 if (damage)
18998 {
18999 if (isCrit)
19000 *damage -= target->GetSpellCritDamageReduction(*damage);
19001 *damage -= target->GetSpellDamageReduction(*damage);
19002 }
19003 break;
19004 default:
19005 break;
19006 }
19007}
@ CR_CRIT_TAKEN_RANGED
Definition Unit.h:232
@ CR_CRIT_TAKEN_SPELL
Definition Unit.h:233
@ CR_CRIT_TAKEN_MELEE
Definition Unit.h:231
float GetSpellCritChanceReduction() const
Definition Unit.h:1203
float GetRangedCritChanceReduction() const
Definition Unit.h:1202
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition Unit.h:1207
float GetMeleeCritChanceReduction() const
Definition Unit.h:1201
uint32 GetRangedDamageReduction(uint32 damage) const
Definition Unit.h:1195
uint32 GetRangedCritDamageReduction(uint32 damage) const
Definition Unit.h:1206
uint32 GetMeleeCritDamageReduction(uint32 damage) const
Definition Unit.h:1205
uint32 GetSpellDamageReduction(uint32 damage) const
Definition Unit.h:1196
uint32 GetMeleeDamageReduction(uint32 damage) const
Definition Unit.h:1194

References CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, GetMeleeCritChanceReduction(), GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetOwner(), GetRangedCritChanceReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritChanceReduction(), GetSpellCritDamageReduction(), GetSpellDamageReduction(), Object::IsCreature(), Object::IsPlayer(), and IsVehicle().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), GetUnitCriticalChance(), spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and SpellTakenCritChance().

◆ ApplyResistanceBuffModsMod()

void Unit::ApplyResistanceBuffModsMod ( SpellSchools  school,
bool  positive,
float  val,
bool  apply 
)
inline
1132{ ApplyModSignedFloatValue(positive ? static_cast<uint16>(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE) + school : static_cast<uint16>(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE) + + school, val, apply); }
@ UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
Definition UpdateFields.h:157
@ UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
Definition UpdateFields.h:158
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition Object.cpp:822
void apply(T *val)
Definition ByteConverter.h:40

References Object::ApplyModSignedFloatValue(), UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, and UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE.

Referenced by AuraEffect::HandleAuraModResistance(), and AuraEffect::HandleAuraModResistanceExclusive().

◆ ApplyResistanceBuffModsPercentMod()

void Unit::ApplyResistanceBuffModsPercentMod ( SpellSchools  school,
bool  positive,
float  val,
bool  apply 
)
inline

◆ ApplySpellDispelImmunity()

void Unit::ApplySpellDispelImmunity ( SpellInfo const *  spellProto,
DispelType  type,
bool  apply 
)
13440{
13441 ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply);
13442
13443 if (apply && spellProto->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
13444 {
13445 // Create dispel mask by dispel type
13446 uint32 dispelMask = SpellInfo::GetDispelMask(type);
13447 // Dispel all existing auras vs current dispel type
13449 for (AuraApplicationMap::iterator itr = auras.begin(); itr != auras.end();)
13450 {
13451 SpellInfo const* spell = itr->second->GetBase()->GetSpellInfo();
13452 if (spell->GetDispelMask() & dispelMask)
13453 {
13454 // Dispel aura
13455 RemoveAura(itr);
13456 }
13457 else
13458 ++itr;
13459 }
13460 }
13461}
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition SharedDefines.h:434
@ IMMUNITY_DISPEL
Definition SharedDefines.h:1398
uint32 GetDispelMask() const
Definition SpellInfo.cpp:2041
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:13412
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:645
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1310

References ApplySpellImmune(), GetAppliedAuras(), SpellInfo::GetDispelMask(), SpellInfo::HasAttribute(), SpellInfo::Id, IMMUNITY_DISPEL, RemoveAura(), and SPELL_ATTR1_IMMUNITY_PURGES_EFFECT.

Referenced by AuraEffect::HandleAuraModDispelImmunity().

◆ ApplySpellImmune()

void Unit::ApplySpellImmune ( uint32  spellId,
uint32  op,
uint32  type,
bool  apply,
SpellImmuneBlockType  blockType = SPELL_BLOCK_TYPE_ALL 
)
13413{
13414 if (apply)
13415 {
13416 // xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty)
13417 if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end())
13418 return;
13419
13420 SpellImmune immune;
13421 immune.spellId = spellId;
13422 immune.type = type;
13423 immune.blockType = blockType;
13424 m_spellImmune[op].push_back(std::move(immune));
13425 }
13426 else
13427 {
13428 for (SpellImmuneList::iterator itr = m_spellImmune[op].begin(); itr != m_spellImmune[op].end(); ++itr)
13429 {
13430 if (itr->spellId == spellId && itr->type == type)
13431 {
13432 m_spellImmune[op].erase(itr);
13433 break;
13434 }
13435 }
13436 }
13437}
Definition Unit.cpp:13403
Definition SpellDefines.h:174
uint32 blockType
Definition SpellDefines.h:179
uint32 spellId
Definition SpellDefines.h:177
uint32 type
Definition SpellDefines.h:178

References SpellImmune::blockType, m_spellImmune, SpellImmune::spellId, and SpellImmune::type.

Referenced by Vehicle::ApplyAllImmunities(), boss_kelidan_the_breaker::ApplyImmunities(), ApplyMechanicImmune(), ApplySpellDispelImmunity(), boss_amanitar::boss_amanitar(), boss_anubarak_trial::boss_anubarak_trialAI::boss_anubarak_trialAI(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_sindragosa::boss_sindragosaAI::boss_sindragosaAI(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_void_reaver::boss_void_reaver(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDmgImmunity(), AuraEffect::HandleAuraModEffectImmunity(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), spell_q13007_iron_colossus::HandleDummy(), spell_love_in_air_perfume_immune::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_dk_anti_magic_shell_self::HandleEffectApply(), spell_dk_army_of_the_dead_passive::HandleEffectApply(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_pet_spellhit_expertise_spellpen_scaling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), spell_love_in_air_perfume_immune::HandleEffectRemove(), spell_dk_anti_magic_shell_self::HandleEffectRemove(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), spell_illidan_shadow_prison_aura::HandleOnEffectApply(), spell_illidan_shadow_prison_aura::HandleOnEffectRemove(), npc_hyjal_jaina::hyjalJainaAI::hyjalJainaAI(), boss_hydross_the_unstable::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Player::LoadFromDB(), Creature::LoadSpellTemplateImmunity(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_target_dummy::npc_target_dummyAI::npc_target_dummyAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::npc_tournament_training_dummyAI(), npc_training_dummy::npc_training_dummyAI::npc_training_dummyAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::npc_ulduar_arachnopod_destroyerAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), spell_yogg_saron_malady_of_the_mind_aura::OnApply(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), npc_chesspiece::Reset(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_felblood_kaelthas::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::Reset(), npc_dark_iron_guzzler::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_gluth::boss_gluthAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_auriaya::boss_auriayaAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_supremus::Reset(), boss_kaelthas::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), boss_supremus::SchedulePhase(), boss_hydross_the_unstable::SetForm(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), Creature::UpdateEntry(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ ApplyStatBuffMod()

void Unit::ApplyStatBuffMod ( Stats  stat,
float  val,
bool  apply 
)
inline
1026{ ApplyModSignedFloatValue((val > 0 ? static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat : static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat), val, apply); }
@ UNIT_FIELD_POSSTAT0
Definition UpdateFields.h:146
@ UNIT_FIELD_NEGSTAT0
Definition UpdateFields.h:151

References Object::ApplyModSignedFloatValue(), UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), and AuraEffect::HandleAuraModStat().

◆ ApplyStatPercentBuffMod()

void Unit::ApplyStatPercentBuffMod ( Stats  stat,
float  val,
bool  apply 
)
15361{
15362 if (val == -100.0f) // prevent set var to zero
15363 val = -99.99f;
15364 float var = GetStat(stat) * val / 100.0f;
15365 ApplyModSignedFloatValue((var > 0 ? static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat : static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat), var, apply);
15366}
float GetStat(Stats stat) const
Definition Unit.h:1001

References Object::ApplyModSignedFloatValue(), GetStat(), UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by AuraEffect::HandleModTotalPercentStat().

◆ ApplyTotalThreatModifier()

float Unit::ApplyTotalThreatModifier ( float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
14665{
14666 if (!HasThreatAura() || fThreat < 0)
14667 return fThreat;
14668
14669 SpellSchools school = GetFirstSchoolInMask(schoolMask);
14670
14671 return fThreat * m_threatModifier[school];
14672}
SpellSchools
Definition SharedDefines.h:282
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
Definition SharedDefines.h:318
bool HasThreatAura() const
Definition Unit.h:1742

References GetFirstSchoolInMask(), HasThreatAura(), and m_threatModifier.

Referenced by ThreatCalcHelper::calcThreat().

◆ Attack()

bool Unit::Attack ( Unit victim,
bool  meleeAttack 
)
Todo:
: Implement aggro range, detection range and assistance range templates
10296{
10297 if (!victim || victim == this)
10298 return false;
10299
10300 // dead units can neither attack nor be attacked
10301 if (!IsAlive() || !victim->IsAlive())
10302 return false;
10303
10304 // pussywizard: check map, world, phase >_> multithreading crash fix
10305 if (!IsInMap(victim) || !InSamePhase(victim))
10306 return false;
10307
10308 // player cannot attack in mount state
10309 if (IsPlayer() && IsMounted())
10310 return false;
10311
10312 // creatures cannot attack while evading
10313 Creature* creature = ToCreature();
10314 if (creature && creature->IsInEvadeMode())
10315 {
10316 return false;
10317 }
10318
10319 // creatures should not try to attack the player during polymorph
10320 if (creature && creature->IsPolymorphed())
10321 {
10322 return false;
10323 }
10324
10325 //if (HasUnitFlag(UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
10326 // return false;
10327
10328 // nobody can attack GM in GM-mode
10329 if (victim->IsPlayer())
10330 {
10331 if (victim->ToPlayer()->IsGameMaster())
10332 return false;
10333 }
10334 else
10335 {
10336 if (victim->ToCreature()->IsEvadingAttacks())
10337 return false;
10338 }
10339
10340 // Unit with SPELL_AURA_SPIRIT_OF_REDEMPTION can not attack
10342 return false;
10343
10344 // remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
10345 if (HasUnattackableAura())
10347
10348 if (m_attacking)
10349 {
10350 if (m_attacking == victim)
10351 {
10352 // switch to melee attack from ranged/magic
10353 if (meleeAttack)
10354 {
10356 {
10358 SendMeleeAttackStart(victim);
10359 return true;
10360 }
10361 }
10363 {
10365 SendMeleeAttackStop(victim);
10366 return true;
10367 }
10368 return false;
10369 }
10370
10371 // switch target
10372 InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
10373 if (!meleeAttack)
10375 }
10376
10377 if (m_attacking)
10379
10380 m_attacking = victim;
10382
10383 // Set our target
10384 SetTarget(victim->GetGUID());
10385
10386 if (meleeAttack)
10388
10389 // set position before any AI calls/assistance
10390 //if (IsCreature())
10391 // ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
10392 if (creature && !(IsControllableGuardian() && IsControlledByPlayer()))
10393 {
10394 // should not let player enter combat by right clicking target - doesn't helps
10395 SetInCombatWith(victim);
10396 if (victim->IsPlayer())
10397 victim->SetInCombatWith(this);
10398 AddThreat(victim, 0.0f);
10399
10401
10404 {
10405 creature->CallAssistance();
10406 }
10408
10410 }
10411
10412 // delay offhand weapon attack by 50% of the base attack time
10415
10416 if (meleeAttack)
10417 SendMeleeAttackStart(victim);
10418
10419 return true;
10420}
@ CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE
Definition CreatureData.h:70
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition IWorld.h:284
@ EMOTE_ONESHOT_NONE
Definition SharedDefines.h:1894
@ AI_REACTION_HOSTILE
Definition SharedDefines.h:3242
@ SPELL_AURA_MOD_UNATTACKABLE
Definition SpellAuraDefines.h:156
@ UNIT_STATE_MELEE_ATTACKING
Definition UnitDefines.h:171
@ CURRENT_MELEE_SPELL
Definition Unit.h:537
@ UNIT_NPC_EMOTESTATE
Definition UpdateFields.h:140
T CalculatePct(T base, U pct)
Definition Util.h:61
void CallAssistance(Unit *target=nullptr)
Definition Creature.cpp:2433
bool IsEvadingAttacks() const
Definition Creature.h:135
void SetAssistanceTimer(uint32 value)
Definition Creature.h:401
void SendAIReaction(AiReaction reactionType)
Definition Creature.cpp:2421
bool IsInEvadeMode() const
Definition Creature.h:134
float GetFloatValue(uint16 index) const
Definition Object.cpp:317
bool IsGameMaster() const
Definition Player.h:1175
bool HasOffhandWeaponForAttack() const
Definition Unit.h:940
void ClearUnitState(uint32 f)
Definition Unit.h:708
bool IsPolymorphed() const
Definition Unit.cpp:16764
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:14676
void _removeAttacker(Unit *pAttacker)
Definition Unit.h:2143
void _addAttacker(Unit *pAttacker)
Definition Unit.h:2142
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition Unit.cpp:13604
bool HasUnattackableAura() const
Definition Unit.h:1744
bool IsMounted() const
Definition Unit.h:1797
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition Unit.cpp:3061
bool IsControllableGuardian() const
Definition Unit.h:759
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:21339
void SendMeleeAttackStop(Unit *victim=nullptr)
Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or int...
Definition Unit.cpp:3077
bool IsControlledByPlayer() const
Definition Unit.h:1238
bool HasSpiritOfRedemptionAura() const
Definition Unit.h:1715
virtual void SetTarget(ObjectGuid=ObjectGuid::Empty)=0
bool InSamePhase(WorldObject const *obj) const
Definition Object.h:452
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1296
#define sWorld
Definition World.h:442

References _addAttacker(), _removeAttacker(), AddThreat(), AddUnitState(), AI_REACTION_HOSTILE, BASE_ATTACK, CalculatePct(), Creature::CallAssistance(), ClearUnitState(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE, CURRENT_MELEE_SPELL, EMOTE_ONESHOT_NONE, CreatureTemplate::flags_extra, getAttackTimer(), Creature::GetCreatureTemplate(), Object::GetFloatValue(), Object::GetGUID(), HasOffhandWeaponForAttack(), HasSpiritOfRedemptionAura(), HasUnattackableAura(), HasUnitState(), WorldObject::InSamePhase(), InterruptSpell(), IsAlive(), isAttackReady(), IsControllableGuardian(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), Player::IsGameMaster(), Creature::IsInEvadeMode(), WorldObject::IsInMap(), IsMounted(), Object::IsPlayer(), IsPolymorphed(), m_attacking, OFF_ATTACK, RemoveAurasByType(), Creature::SendAIReaction(), SendMeleeAttackStart(), SendMeleeAttackStop(), Creature::SetAssistanceTimer(), setAttackTimer(), SetInCombatWith(), SetTarget(), SetUInt32Value(), SPELL_AURA_MOD_UNATTACKABLE, sWorld, Object::ToCreature(), Object::ToPlayer(), UNIT_FIELD_BASEATTACKTIME, UNIT_NPC_EMOTESTATE, and UNIT_STATE_MELEE_ATTACKING.

Referenced by UnitAI::AttackStart(), FollowerAI::AttackStart(), PossessedAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::AttackStart(), npc_gunship_mage::npc_gunship_mageAI::AttackStart(), npc_gunship_gunner::npc_gunship_gunnerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), TurretAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), boss_jormungarAI::AttackStart(), boss_four_horsemen::boss_four_horsemenAI::AttackStart(), boss_magus_telestra::AttackStart(), boss_kologarn::boss_kologarnAI::AttackStart(), boss_mimiron::boss_mimironAI::AttackStart(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_lady_malande::AttackStart(), boss_the_lurker_below::AttackStart(), boss_olm_the_summoner::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), boss_nazan::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), npc_pet_gen_gnomish_flame_turret::AttackStart(), UnitAI::AttackStartCaster(), ScriptedAI::AttackStartNoMove(), PetAI::DoAttack(), WorldSession::HandleAttackSwingOpcode(), spell_q12096_q12092_dummy::HandleDummy(), WorldSession::HandlePetActionHelper(), boss_halazzi::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), RemoveCharmedBy(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), Player::UpdateCharmedAI(), and npc_ranger_lilatha::WaypointReached().

◆ AttackerStateUpdate()

void Unit::AttackerStateUpdate ( Unit victim,
WeaponAttackType  attType = BASE_ATTACK,
bool  extra = false,
bool  ignoreCasting = false 
)
2566{
2568 {
2569 return;
2570 }
2571
2572 if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) && !extra && !ignoreCasting)
2573 {
2574 return;
2575 }
2576
2577 if (!victim->IsAlive())
2578 return;
2579
2580 if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
2581 return;
2582
2583 // CombatStart puts the target into stand state, so we need to cache sit state here to know if we should crit later
2584 const bool sittingVictim = victim->IsPlayer() && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP);
2585
2586 CombatStart(victim);
2588
2589 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
2590 return; // ignore ranged case
2591
2592 if (!extra && _lastExtraAttackSpell)
2593 {
2595 }
2596
2597 bool meleeAttack = true;
2598
2599 // melee attack spell casted at main hand attack only - no normal melee dmg dealt
2600 if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
2601 {
2602 meleeAttack = false; // The melee attack is replaced by the melee spell
2603
2605 SpellCastResult castResult = meleeSpell->CheckCast(false);
2606 if (castResult != SPELL_CAST_OK)
2607 {
2608 meleeSpell->SendCastResult(castResult);
2609 meleeSpell->SendInterrupted(0);
2610
2611 meleeSpell->finish(false);
2612 meleeSpell->SetExecutedCurrently(false);
2613
2614 if (castResult == SPELL_FAILED_NO_POWER)
2615 {
2616 // Not enough rage, do a regular melee attack instead
2617 meleeAttack = true;
2618 }
2619 }
2620 else
2621 {
2622 meleeSpell->cast(true);
2623 }
2624 }
2625 if (meleeAttack)
2626 {
2627 // attack can be redirected to another target
2628 victim = GetMeleeHitRedirectTarget(victim);
2629 CalcDamageInfo damageInfo;
2630 CalculateMeleeDamage(victim, &damageInfo, attType, sittingVictim);
2631
2632 // Send log damage message to client
2633 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2634 {
2635 Unit::DealDamageMods(victim, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
2636 }
2637
2638 SendAttackStateUpdate(&damageInfo);
2639
2640 //TriggerAurasProcOnEvent(damageInfo);
2641
2642 _lastDamagedTargetGuid = victim->GetGUID();
2643
2644 DealMeleeDamage(&damageInfo, true);
2645
2646 DamageInfo dmgInfo(damageInfo);
2647 Unit::ProcDamageAndSpell(damageInfo.attacker, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, dmgInfo.GetDamage(),
2648 damageInfo.attackType, nullptr, nullptr, -1, nullptr, &dmgInfo);
2649
2650 if (IsPlayer())
2651 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2652 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2653 else
2654 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2655 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2656
2657 // Let the pet know we've started attacking someting. Handles melee attacks only
2658 // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
2659 if (IsPlayer() && !m_Controlled.empty())
2660 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
2661 if (Unit* pet = *itr)
2662 if (pet->IsAlive() && pet->IsCreature())
2663 pet->ToCreature()->AI()->OwnerAttacked(victim);
2664 }
2665}
#define MAX_ITEM_PROTO_DAMAGES
Definition ItemTemplate.h:613
@ SPELL_FAILED_NO_POWER
Definition SharedDefines.h:1034
@ AURA_INTERRUPT_FLAG_MELEE_ATTACK
Definition SpellDefines.h:55
@ UNIT_STAND_STATE_SLEEP
Definition UnitDefines.h:35
@ UNIT_STATE_CANNOT_AUTOATTACK
Definition UnitDefines.h:214
@ UNIT_FLAG_PACIFIED
Definition UnitDefines.h:267
Definition Unit.h:330
std::string ToString() const
Definition ObjectGuid.cpp:47
void cast(bool skipCheck=false)
Definition Spell.cpp:3794
void SetExecutedCurrently(bool yes)
Definition Spell.h:565
void SendInterrupted(uint8 result)
Definition Spell.cpp:5179
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition Spell.cpp:4674
void finish(bool ok=true)
Definition Spell.cpp:4487
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6502
void CombatStart(Unit *target, bool initialAggro=true)
Definition Unit.cpp:13652
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:11080
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition Unit.cpp:1464
static void ProcDamageAndSpell(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:6401
uint8 getStandState() const
Definition Unit.h:1692
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition Unit.cpp:1829
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:800
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition Object.cpp:1358
Definition Unit.h:463
uint32 procAttacker
Definition Unit.h:480
uint32 procVictim
Definition Unit.h:481
struct CalcDamageInfo::@264 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 absorb
Definition Unit.h:471
uint32 damage
Definition Unit.h:470
uint32 procEx
Definition Unit.h:482
Unit * attacker
Definition Unit.h:464
Unit * target
Definition Unit.h:465
WeaponAttackType attackType
Definition Unit.h:479
std::string ToString() const
Definition Position.cpp:52

References _lastDamagedTargetGuid, _lastExtraAttackSpell, CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::attackType, AURA_INTERRUPT_FLAG_MELEE_ATTACK, BASE_ATTACK, CalculateMeleeDamage(), Spell::cast(), Spell::CheckCast(), CombatStart(), CURRENT_MELEE_SPELL, CalcDamageInfo::damage, CalcDamageInfo::damages, DealDamageMods(), DealMeleeDamage(), Spell::finish(), DamageInfo::GetAbsorb(), DamageInfo::GetBlock(), DamageInfo::GetDamage(), Object::GetGUID(), Object::GetGUID(), GetMeleeHitRedirectTarget(), DamageInfo::GetResist(), getStandState(), HasUnitFlag(), HasUnitState(), IsAlive(), Object::IsPlayer(), IsSitState(), WorldObject::IsWithinLOSInMap(), LOG_DEBUG, m_Controlled, m_currentSpells, MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, CalcDamageInfo::procAttacker, ProcDamageAndSpell(), CalcDamageInfo::procEx, CalcDamageInfo::procVictim, RemoveAurasWithInterruptFlags(), SendAttackStateUpdate(), Spell::SendCastResult(), Spell::SendInterrupted(), Spell::SetExecutedCurrently(), SPELL_CAST_OK, SPELL_FAILED_NO_POWER, CalcDamageInfo::target, ObjectGuid::ToString(), Position::ToString(), UNIT_FLAG_PACIFIED, UNIT_STAND_STATE_SLEEP, and UNIT_STATE_CANNOT_AUTOATTACK.

Referenced by UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), HandleProcExtraAttackFor(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Player::Update(), boss_dred::boss_dredAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), and boss_the_lurker_below::UpdateAI().

◆ AttackStop()

bool Unit::AttackStop ( )

Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.

10427{
10428 if (!m_attacking)
10429 return false;
10430
10431 Unit* victim = m_attacking;
10432
10434 m_attacking = nullptr;
10435
10436 // Clear our target
10438
10440
10442
10443 // reset only at real combat stop
10444 if (Creature* creature = ToCreature())
10445 {
10446 creature->SetNoCallAssistance(false);
10447
10448 if (creature->HasSearchedAssistance())
10449 {
10450 creature->SetNoSearchAssistance(false);
10451 }
10452 }
10453
10454 SendMeleeAttackStop(victim);
10455
10456 return true;
10457}

References _removeAttacker(), ClearUnitState(), CURRENT_MELEE_SPELL, ObjectGuid::Empty, InterruptSpell(), m_attacking, SendMeleeAttackStop(), SetTarget(), Object::ToCreature(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by PetAI::_stopAttack(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CombatStop(), boss_jedoga_shadowseeker::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), advisor_baseAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_thekal::DamageTaken(), boss_viscidus::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), ScriptedAI::DoStopAttack(), Player::DuelComplete(), Spell::EffectSanctuary(), SmartAI::EnterEvadeMode(), Spell::finish(), WorldSession::HandleAttackStopOpcode(), spell_hun_scatter_shot::HandleDummy(), spell_mc_play_dead_aura::HandleEffectApply(), spell_q11065_wrangle_some_aether_rays_aura::HandleEffectApply(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetStopAttack(), RotateMovementGenerator::Initialize(), boss_janalai::JustEngagedWith(), PetAI::KilledUnit(), MotionMaster::MoveSeekAssistance(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), PetSpellFail(), RemoveCharmedBy(), boss_janalai::Reset(), boss_warbringer_omrogg::ScheduleBurningPhase(), boss_warbringer_omrogg::ScheduleNonBurningPhase(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_attumen::SpellHit(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_heigan::boss_heiganAI::StartFightPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), StopAttackFaction(), StopAttackingInvalidTarget(), boss_ouro::Submerge(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ BuildAuraStateUpdateForTarget()

uint32 Unit::BuildAuraStateUpdateForTarget ( Unit target) const
10560{
10562 for (AuraStateAurasMap::const_iterator itr = m_auraStateAuras.begin(); itr != m_auraStateAuras.end(); ++itr)
10563 if ((1 << (itr->first - 1)) & PER_CASTER_AURA_STATE_MASK)
10564 if (itr->second->GetBase()->GetCasterGUID() == target->GetGUID())
10565 auraStates |= (1 << (itr->first - 1));
10566
10567 return auraStates;
10568}
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:305

References Object::GetGUID(), Object::GetUInt32Value(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, and UNIT_FIELD_AURASTATE.

Referenced by PatchValuesUpdate().

◆ BuildCooldownPacket() [1/2]

void Unit::BuildCooldownPacket ( WorldPacket data,
uint8  flags,
PacketCooldowns const &  cooldowns 
)
21018{
21019 data.Initialize(SMSG_SPELL_COOLDOWN, 8 + 1 + (4 + 4) * cooldowns.size());
21020 data << GetGUID();
21021 data << uint8(flags);
21022 for (std::unordered_map<uint32, uint32>::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
21023 {
21024 data << uint32(itr->first);
21025 data << uint32(itr->second);
21026 }
21027}
uint8 flags
Definition DisableMgr.cpp:37
void Initialize(uint16 opcode, std::size_t newres=200)
Definition WorldPacket.h:68
@ SMSG_SPELL_COOLDOWN
Definition Opcodes.h:338

References flags, Object::GetGUID(), WorldPacket::Initialize(), and SMSG_SPELL_COOLDOWN.

◆ BuildCooldownPacket() [2/2]

◆ BuildHeartBeatMsg()

void Unit::BuildHeartBeatMsg ( WorldPacket data) const
2085{
2086 data->Initialize(MSG_MOVE_HEARTBEAT, 32);
2087 *data << GetPackGUID();
2088 BuildMovementPacket(data);
2089}
void BuildMovementPacket(ByteBuffer *data) const
Definition Unit.cpp:19923
@ MSG_MOVE_HEARTBEAT
Definition Opcodes.h:268

References BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), and MSG_MOVE_HEARTBEAT.

Referenced by boss_volkhan::boss_volkhanAI::MovementInform(), and SendMovementFlagUpdate().

◆ BuildMovementPacket()

void Unit::BuildMovementPacket ( ByteBuffer data) const
19924{
19925 *data << uint32(GetUnitMovementFlags()); // movement flags
19926 *data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
19927 *data << uint32(GameTime::GetGameTimeMS().count()); // time / counter
19928 *data << GetPositionX();
19929 *data << GetPositionY();
19930 *data << GetPositionZ();
19931 *data << GetOrientation();
19932
19933 // 0x00000200
19935 {
19936 if (m_vehicle)
19937 *data << m_vehicle->GetBase()->GetPackGUID();
19938 else if (GetTransport())
19939 *data << GetTransport()->GetPackGUID();
19940 else
19941 *data << (uint8)0;
19942
19943 *data << float (GetTransOffsetX());
19944 *data << float (GetTransOffsetY());
19945 *data << float (GetTransOffsetZ());
19946 *data << float (GetTransOffsetO());
19947 *data << uint32(GetTransTime());
19948 *data << uint8 (GetTransSeat());
19949
19952 }
19953
19954 // 0x02200000
19957 *data << (float)m_movementInfo.pitch;
19958
19959 *data << (uint32)m_movementInfo.fallTime;
19960
19961 // 0x00001000
19963 {
19964 *data << (float)m_movementInfo.jump.zspeed;
19965 *data << (float)m_movementInfo.jump.sinAngle;
19966 *data << (float)m_movementInfo.jump.cosAngle;
19967 *data << (float)m_movementInfo.jump.xyspeed;
19968 }
19969
19970 // 0x04000000
19972 *data << (float)m_movementInfo.splineElevation;
19973}
@ MOVEMENTFLAG_ONTRANSPORT
Definition UnitDefines.h:374
@ MOVEMENTFLAG_FLYING
Definition UnitDefines.h:390
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:377
@ MOVEMENTFLAG_SWIMMING
Definition UnitDefines.h:386
@ MOVEMENTFLAG_SPLINE_ELEVATION
Definition UnitDefines.h:391
@ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
Definition UnitDefines.h:426
@ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT
Definition UnitDefines.h:431
uint32 GetUnitMovementFlags() const
Definition Unit.h:743
uint16 GetExtraUnitMovementFlags() const
Definition Unit.h:749
float GetTransOffsetX() const
Definition Object.h:598
float GetTransOffsetY() const
Definition Object.h:599
float GetTransOffsetZ() const
Definition Object.h:600
uint32 GetTransTime() const
Definition Object.h:602
Transport * GetTransport() const
Definition Object.h:597
float GetTransOffsetO() const
Definition Object.h:601
float cosAngle
Definition Object.h:322
float xyspeed
Definition Object.h:322
float zspeed
Definition Object.h:322
float sinAngle
Definition Object.h:322
uint32 time2
Definition Object.h:305
struct MovementInfo::JumpInfo jump
uint32 fallTime
Definition Object.h:312
struct MovementInfo::TransportInfo transport
float splineElevation
Definition Object.h:326
float pitch
Definition Object.h:309

References MovementInfo::JumpInfo::cosAngle, MovementInfo::fallTime, MovementInfo::flags2, Vehicle::GetBase(), GetExtraUnitMovementFlags(), GameTime::GetGameTimeMS(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), WorldObject::GetTransSeat(), WorldObject::GetTransTime(), GetUnitMovementFlags(), MovementInfo::jump, WorldObject::m_movementInfo, m_vehicle, MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING, MOVEMENTFLAG2_INTERPOLATED_MOVEMENT, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FLYING, MOVEMENTFLAG_ONTRANSPORT, MOVEMENTFLAG_SPLINE_ELEVATION, MOVEMENTFLAG_SWIMMING, MovementInfo::pitch, MovementInfo::JumpInfo::sinAngle, MovementInfo::splineElevation, MovementInfo::TransportInfo::time2, MovementInfo::transport, MovementInfo::JumpInfo::xyspeed, and MovementInfo::JumpInfo::zspeed.

Referenced by BuildHeartBeatMsg(), Object::BuildMovementUpdate(), WorldSession::HandleMoveKnockBackAck(), Player::SendTeleportAckPacket(), SendTeleportPacket(), Player::SetCanFly(), Creature::SetCanFly(), Creature::SetDisableGravity(), Player::SetDisableGravity(), Player::SetFeatherFall(), Creature::SetFeatherFall(), Player::SetHover(), SetSpeed(), Player::SetWaterWalking(), and Creature::SetWaterWalking().

◆ BuildValuesUpdate()

void Unit::BuildValuesUpdate ( uint8  updateType,
ByteBuffer data,
Player target 
)
overrideprotectedvirtual

Reimplemented from Object.

20734{
20735 if (!target)
20736 return;
20737
20739 uint32 visibleFlag = UF_FLAG_PUBLIC;
20740
20741 if (target == this)
20742 visibleFlag |= UF_FLAG_PRIVATE;
20743
20745 if (GetOwnerGUID() == target->GetGUID())
20746 visibleFlag |= UF_FLAG_OWNER;
20747
20750 visibleFlag |= UF_FLAG_SPECIAL_INFO;
20751
20752 if (plr && plr->IsInSameRaidWith(target))
20753 visibleFlag |= UF_FLAG_PARTY_MEMBER;
20754
20755 uint64 cacheKey = static_cast<uint64>(visibleFlag) << 8 | updateType;
20756
20757 auto cacheIt = _valuesUpdateCache.find(cacheKey);
20758 if (cacheIt != _valuesUpdateCache.end())
20759 {
20760 int32 cachePos = static_cast<int32>(data->wpos());
20761 data->append(cacheIt->second.buffer);
20762
20763 BuildValuesCachePosPointers dataAdjustedPos = cacheIt->second.posPointers;
20764 if (cachePos)
20765 dataAdjustedPos.ApplyOffset(cachePos);
20766
20767 PatchValuesUpdate(*data, dataAdjustedPos, target);
20768
20769 return;
20770 }
20771
20772 BuildValuesCachedBuffer cacheValue(500);
20773
20774 ByteBuffer fieldBuffer(400);
20775
20776 UpdateMask updateMask;
20777 updateMask.SetCount(m_valuesCount);
20778
20779 for (uint16 index = 0; index < m_valuesCount; ++index)
20780 {
20781 if (_fieldNotifyFlags & flags[index] ||
20782 ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) ||
20783 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
20785 {
20786 updateMask.SetBit(index);
20787
20788 if (index == UNIT_NPC_FLAGS)
20789 {
20790 cacheValue.posPointers.UnitNPCFlagsPos = int32(fieldBuffer.wpos());
20791 fieldBuffer << m_uint32Values[UNIT_NPC_FLAGS];
20792 }
20793 else if (index == UNIT_FIELD_AURASTATE)
20794 {
20795 cacheValue.posPointers.UnitFieldAuraStatePos = int32(fieldBuffer.wpos());
20796 fieldBuffer << uint32(0); // Fill in later.
20797 }
20798 // FIXME: Some values at server stored in float format but must be sent to client in uint32 format
20799 else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
20800 {
20801 // convert from float to uint32 and send
20802 fieldBuffer << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
20803 }
20804 // there are some float values which may be negative or can't get negative due to other checks
20805 else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
20808 (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
20809 {
20810 fieldBuffer << uint32(m_floatValues[index]);
20811 }
20812 // Gamemasters should be always able to select units - remove not selectable flag
20813 else if (index == UNIT_FIELD_FLAGS)
20814 {
20815 cacheValue.posPointers.UnitFieldFlagsPos = int32(fieldBuffer.wpos());
20816 fieldBuffer << m_uint32Values[UNIT_FIELD_FLAGS];
20817 }
20818 // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
20819 else if (index == UNIT_FIELD_DISPLAYID)
20820 {
20821 cacheValue.posPointers.UnitFieldDisplayPos = int32(fieldBuffer.wpos());
20822 fieldBuffer << m_uint32Values[UNIT_FIELD_DISPLAYID];
20823 }
20824 else if (index == UNIT_DYNAMIC_FLAGS)
20825 {
20826 cacheValue.posPointers.UnitDynamicFlagsPos = int32(fieldBuffer.wpos());
20828 fieldBuffer << dynamicFlags;
20829 }
20830 else if (index == UNIT_FIELD_BYTES_2)
20831 {
20832 cacheValue.posPointers.UnitFieldBytes2Pos = int32(fieldBuffer.wpos());
20833 fieldBuffer << m_uint32Values[index];
20834 }
20835 else if (index == UNIT_FIELD_FACTIONTEMPLATE)
20836 {
20837 cacheValue.posPointers.UnitFieldFactionTemplatePos = int32(fieldBuffer.wpos());
20838 fieldBuffer << m_uint32Values[index];
20839 }
20840 else
20841 {
20842 if (sScriptMgr->ShouldTrackValuesUpdatePosByIndex(this, updateType, index))
20843 cacheValue.posPointers.other[index] = static_cast<uint32>(fieldBuffer.wpos());
20844
20845 // send in current format (float as float, uint32 as uint32)
20846 fieldBuffer << m_uint32Values[index];
20847 }
20848 }
20849 }
20850
20851 cacheValue.buffer << uint8(updateMask.GetBlockCount());
20852 updateMask.AppendToPacket(&cacheValue.buffer);
20853 int32 fieldBufferPos = static_cast<int32>(cacheValue.buffer.wpos());
20854 cacheValue.buffer.append(fieldBuffer);
20855 cacheValue.posPointers.ApplyOffset(fieldBufferPos);
20856
20857 int32 cachePos = static_cast<int32>(data->wpos());
20858 data->append(cacheValue.buffer);
20859
20860 BuildValuesCachePosPointers dataAdjustedPos = cacheValue.posPointers;
20861 if (cachePos)
20862 dataAdjustedPos.ApplyOffset(cachePos);
20863
20864 PatchValuesUpdate(*data, dataAdjustedPos, target);
20865
20866 _valuesUpdateCache.insert(std::pair<uint64, BuildValuesCachedBuffer>(cacheKey, std::move(cacheValue)));
20867}
std::uint64_t uint64
Definition Define.h:106
@ UNIT_DYNFLAG_SPECIALINFO
Definition SharedDefines.h:3125
@ UNIT_DYNFLAG_TAPPED_BY_PLAYER
Definition SharedDefines.h:3124
@ UNIT_DYNFLAG_TAPPED
Definition SharedDefines.h:3123
@ SPELL_AURA_EMPATHY
Definition SpellAuraDefines.h:184
@ UPDATETYPE_VALUES
Definition UpdateData.h:28
uint32 UnitUpdateFieldFlags[PLAYER_END]
Definition UpdateFieldFlags.cpp:162
@ UF_FLAG_SPECIAL_INFO
Definition UpdateFieldFlags.h:32
@ UF_FLAG_PUBLIC
Definition UpdateFieldFlags.h:27
@ UF_FLAG_OWNER
Definition UpdateFieldFlags.h:29
@ UF_FLAG_PRIVATE
Definition UpdateFieldFlags.h:28
@ UF_FLAG_PARTY_MEMBER
Definition UpdateFieldFlags.h:33
@ UNIT_NPC_FLAGS
Definition UpdateFields.h:139
@ UNIT_FIELD_RANGEDATTACKTIME
Definition UpdateFields.h:121
@ UNIT_FIELD_DISPLAYID
Definition UpdateFields.h:124
@ UNIT_FIELD_FACTIONTEMPLATE
Definition UpdateFields.h:115
@ UNIT_FIELD_POSSTAT4
Definition UpdateFields.h:150
@ UNIT_FIELD_NEGSTAT4
Definition UpdateFields.h:155
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
@ UNIT_DYNAMIC_FLAGS
Definition UpdateFields.h:136
Definition ByteBuffer.h:70
void append(T value)
Definition ByteBuffer.h:129
std::size_t wpos() const
Definition ByteBuffer.h:330
uint16 _fieldNotifyFlags
Definition Object.h:261
bool HasDynamicFlag(uint32 flag) const
Definition Object.h:122
UpdateMask _changesMask
Definition Object.h:257
uint32 * m_uint32Values
Definition Object.h:253
uint16 m_valuesCount
Definition Object.h:259
float * m_floatValues
Definition Object.h:254
bool IsInSameRaidWith(Player const *p) const
Definition Player.h:1889
ValuesUpdateCache _valuesUpdateCache
Definition Unit.h:2174
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Unit.cpp:10639
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition Unit.cpp:5733
ObjectGuid GetOwnerGUID() const
Definition Unit.h:684
void PatchValuesUpdate(ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
Definition Unit.cpp:20869
Definition UpdateMask.h:25
uint32 GetBlockCount() const
Definition UpdateMask.h:62
bool GetBit(uint32 index) const
Definition UpdateMask.h:47
void SetCount(uint32 valuesCount)
Definition UpdateMask.h:65
void SetBit(uint32 index)
Definition UpdateMask.h:45
void AppendToPacket(ByteBuffer *data)
Definition UpdateMask.h:49
Definition UnitUtils.h:65
void ApplyOffset(uint32 offset)
Definition UnitUtils.h:70
Definition UnitUtils.h:110

References Object::_changesMask, Object::_fieldNotifyFlags, _valuesUpdateCache, ByteBuffer::append(), UpdateMask::AppendToPacket(), BuildValuesCachePosPointers::ApplyOffset(), BuildValuesCachedBuffer::buffer, flags, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetGUID(), GetOwnerGUID(), HasAuraTypeWithCaster(), Object::HasDynamicFlag(), Object::HasFlag(), Player::IsInSameRaidWith(), Object::m_floatValues, Object::m_uint32Values, Object::m_valuesCount, BuildValuesCachePosPointers::other, PatchValuesUpdate(), PER_CASTER_AURA_STATE_MASK, BuildValuesCachedBuffer::posPointers, UpdateMask::SetBit(), UpdateMask::SetCount(), SPELL_AURA_EMPATHY, sScriptMgr, UF_FLAG_OWNER, UF_FLAG_PARTY_MEMBER, UF_FLAG_PRIVATE, UF_FLAG_PUBLIC, UF_FLAG_SPECIAL_INFO, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FACTIONTEMPLATE, UNIT_FIELD_FLAGS, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_NEGSTAT4, UNIT_FIELD_POSSTAT0, UNIT_FIELD_POSSTAT4, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, BuildValuesCachePosPointers::UnitNPCFlagsPos, UnitUpdateFieldFlags, UPDATETYPE_VALUES, and ByteBuffer::wpos().

◆ CalcAbsorbResist()

void Unit::CalcAbsorbResist ( DamageInfo dmgInfo,
bool  Splited = false 
)
static
2148{
2149 Unit* victim = dmgInfo.GetVictim();
2150 Unit* attacker = dmgInfo.GetAttacker();
2151 uint32 damage = dmgInfo.GetDamage();
2152 SpellSchoolMask schoolMask = dmgInfo.GetSchoolMask();
2153 SpellInfo const* spellInfo = dmgInfo.GetSpellInfo();
2154
2155 if (!victim || !victim->IsAlive() || !damage)
2156 return;
2157
2158 // Magic damage, check for resists
2159 // Ignore spells that cant be resisted
2160 // Xinef: holy resistance exists for npcs
2161 if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->IsCreature()) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))))
2162 {
2163 float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim);
2164
2165 float discreteResistProbability[11];
2166 for (uint32 i = 0; i < 11; ++i)
2167 {
2168 discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
2169 if (discreteResistProbability[i] < 0.0f)
2170 discreteResistProbability[i] = 0.0f;
2171 }
2172
2173 if (averageResist <= 0.1f)
2174 {
2175 discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
2176 discreteResistProbability[1] = 5.0f * averageResist;
2177 discreteResistProbability[2] = 2.5f * averageResist;
2178 }
2179
2180 float r = float(rand_norm());
2181 uint32 i = 0;
2182 float probabilitySum = discreteResistProbability[0];
2183
2184 while (r >= probabilitySum && i < 10)
2185 probabilitySum += discreteResistProbability[++i];
2186
2187 float damageResisted = float(damage * i / 10);
2188
2189 if (damageResisted) // if equal to 0, checking these is pointless
2190 {
2191 if (attacker)
2192 {
2194 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2195 if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo))
2196 AddPct(damageResisted, -(*j)->GetAmount());
2197
2199 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2200 if ((*j)->GetMiscValue() & schoolMask)
2201 AddPct(damageResisted, -(*j)->GetAmount());
2202 }
2203
2204 // pussywizard:
2205 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC))
2206 {
2207 uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK);
2208 uint32 armorReduction = damage - damageAfterArmor;
2209 if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts
2210 damageResisted = armorReduction;
2211 }
2212 }
2213
2214 dmgInfo.ResistDamage(uint32(damageResisted));
2215 }
2216
2217 // Ignore Absorption Auras
2218 float auraAbsorbMod = 0;
2219 if (attacker)
2220 {
2222 for (AuraEffectList::const_iterator itr = AbsIgnoreAurasA.begin(); itr != AbsIgnoreAurasA.end(); ++itr)
2223 {
2224 if (!((*itr)->GetMiscValue() & schoolMask))
2225 continue;
2226
2227 if ((*itr)->GetAmount() > auraAbsorbMod)
2228 auraAbsorbMod = float((*itr)->GetAmount());
2229 }
2230
2232 for (AuraEffectList::const_iterator itr = AbsIgnoreAurasB.begin(); itr != AbsIgnoreAurasB.end(); ++itr)
2233 {
2234 if (!((*itr)->GetMiscValue() & schoolMask))
2235 continue;
2236
2237 if (((*itr)->GetAmount() > auraAbsorbMod) && (*itr)->IsAffectedOnSpell(spellInfo))
2238 auraAbsorbMod = float((*itr)->GetAmount());
2239 }
2240 RoundToInterval(auraAbsorbMod, 0.0f, 100.0f);
2241 }
2242
2243 // We're going to call functions which can modify content of the list during iteration over it's elements
2244 // Let's copy the list so we can prevent iterator invalidation
2246 vSchoolAbsorbCopy.sort(Acore::AbsorbAuraOrderPred());
2247
2248 // absorb without mana cost
2249 for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2250 {
2251 AuraEffect* absorbAurEff = *itr;
2252 // Check if aura was removed during iteration - we don't need to work on such auras
2253 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2254 if (!aurApp)
2255 continue;
2256 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2257 continue;
2258
2259 // get amount which can be still absorbed by the aura
2260 int32 currentAbsorb = absorbAurEff->GetAmount();
2261 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2262 if (currentAbsorb < 0)
2263 currentAbsorb = 0;
2264
2265 uint32 tempAbsorb = uint32(currentAbsorb);
2266
2267 bool defaultPrevented = false;
2268
2269 absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2270 currentAbsorb = tempAbsorb;
2271
2272 if (defaultPrevented)
2273 continue;
2274
2275 // absorb must be smaller than the damage itself
2276 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2277
2278 // xinef: do this after absorb is rounded to damage...
2279 AddPct(currentAbsorb, -auraAbsorbMod);
2280
2281 dmgInfo.AbsorbDamage(currentAbsorb);
2282
2283 tempAbsorb = currentAbsorb;
2284 absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2285
2286 // Check if our aura is using amount to count damage
2287 if (absorbAurEff->GetAmount() >= 0)
2288 {
2289 // Reduce shield amount
2290 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2291 // Aura cannot absorb anything more - remove it
2292 if (absorbAurEff->GetAmount() <= 0)
2293 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2294 }
2295 }
2296
2297 // absorb by mana cost
2299 for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2300 {
2301 AuraEffect* absorbAurEff = *itr;
2302 // Check if aura was removed during iteration - we don't need to work on such auras
2303 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2304 if (!aurApp)
2305 continue;
2306 // check damage school mask
2307 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2308 continue;
2309
2310 // get amount which can be still absorbed by the aura
2311 int32 currentAbsorb = absorbAurEff->GetAmount();
2312 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2313 if (currentAbsorb < 0)
2314 currentAbsorb = 0;
2315
2316 uint32 tempAbsorb = currentAbsorb;
2317
2318 bool defaultPrevented = false;
2319
2320 absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2321 currentAbsorb = tempAbsorb;
2322
2323 if (defaultPrevented)
2324 continue;
2325
2326 // absorb must be smaller than the damage itself
2327 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2328
2329 // xinef: do this after absorb is rounded to damage...
2330 AddPct(currentAbsorb, -auraAbsorbMod);
2331
2332 int32 manaReduction = currentAbsorb;
2333
2334 // lower absorb amount by talents
2335 if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
2336 manaReduction = int32(float(manaReduction) * manaMultiplier);
2337
2338 int32 manaTaken = -victim->ModifyPower(POWER_MANA, -manaReduction);
2339
2340 // take case when mana has ended up into account
2341 currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
2342
2343 dmgInfo.AbsorbDamage(currentAbsorb);
2344
2345 tempAbsorb = currentAbsorb;
2346 absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2347
2348 // Check if our aura is using amount to count damage
2349 if (absorbAurEff->GetAmount() >= 0)
2350 {
2351 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2352 if ((absorbAurEff->GetAmount() <= 0))
2353 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2354 }
2355 }
2356
2357 // split damage auras - only when not damaging self
2358 // Xinef: not true - Warlock Hellfire
2359 if (/*victim != attacker &&*/ !Splited)
2360 {
2361 // We're going to call functions which can modify content of the list during iteration over it's elements
2362 // Let's copy the list so we can prevent iterator invalidation
2363 AuraEffectList vSplitDamageFlatCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_FLAT)); // Not used by any spell
2364 for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2365 {
2366 // Check if aura was removed during iteration - we don't need to work on such auras
2367 if (!((*itr)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
2368 continue;
2369 // check damage school mask
2370 if (!((*itr)->GetMiscValue() & schoolMask))
2371 continue;
2372
2373 // Damage can be splitted only if aura has an alive caster
2374 Unit* caster = (*itr)->GetCaster();
2375 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2376 continue;
2377
2378 // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
2379 // Ignore LOS attribute is only used for the cast portion of the spell
2380 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2381 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
2382 if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2383 continue;
2384
2385 int32 splitDamage = (*itr)->GetAmount();
2386
2387 // absorb must be smaller than the damage itself
2388 splitDamage = RoundToInterval(splitDamage, 0, int32(dmgInfo.GetDamage()));
2389
2390 dmgInfo.AbsorbDamage(splitDamage);
2391
2392 uint32 splitted = splitDamage;
2393 uint32 splitted_absorb = 0;
2394 uint32 splitted_resist = 0;
2395
2396 uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT;
2397 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, schoolMask, dmgInfo.GetDamageType());
2398 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2399 {
2400 procEx |= PROC_EX_IMMUNE;
2401 splittedDmgInfo.AbsorbDamage(splitted);
2402 }
2403 else
2404 {
2405 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2406 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2407 }
2408
2409 splitted_absorb = splittedDmgInfo.GetAbsorb();
2410 splitted_resist = splittedDmgInfo.GetResist();
2411 splitted = splittedDmgInfo.GetDamage();
2412
2413 // create procs
2414 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2415 caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, nullptr, -1, nullptr, &splittedDmgInfo);
2416
2417 if (attacker)
2418 {
2419 attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo(), splitted, schoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2420 }
2421
2422 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2423 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
2424 }
2425
2426 // We're going to call functions which can modify content of the list during iteration over it's elements
2427 // Let's copy the list so we can prevent iterator invalidation
2429 for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(), next; (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2430 {
2431 // Check if aura was removed during iteration - we don't need to work on such auras
2432 AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2433 if (!aurApp)
2434 continue;
2435
2436 // check damage school mask
2437 if (!((*itr)->GetMiscValue() & schoolMask))
2438 continue;
2439
2440 // Damage can be splitted only if aura has an alive caster
2441 Unit* caster = (*itr)->GetCaster();
2442 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2443 continue;
2444
2445 // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
2446 // Ignore LOS attribute is only used for the cast portion of the spell
2447 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2448 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
2449 if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2450 continue;
2451
2452 uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
2453 SpellSchoolMask splitSchoolMask = schoolMask;
2454
2455 (*itr)->GetBase()->CallScriptEffectSplitHandlers(*itr, aurApp, dmgInfo, splitDamage);
2456
2457 // absorb must be smaller than the damage itself
2458 splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
2459
2460 // Roar of Sacrifice, dont absorb it
2461 if (splitSpellInfo->Id != 53480)
2462 dmgInfo.AbsorbDamage(splitDamage);
2463 else
2464 splitSchoolMask = SPELL_SCHOOL_MASK_NATURE;
2465
2466 uint32 splitted = splitDamage;
2467 uint32 splitted_absorb = 0;
2468 uint32 splitted_resist = 0;
2469
2470 uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT;
2471 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, splitSchoolMask, dmgInfo.GetDamageType());
2472 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2473 {
2474 procEx |= PROC_EX_IMMUNE;
2475 splittedDmgInfo.AbsorbDamage(splitted);
2476 }
2477 else
2478 {
2479 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2480 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2481 }
2482
2483 splitted_absorb = splittedDmgInfo.GetAbsorb();
2484 splitted_resist = splittedDmgInfo.GetResist();
2485 splitted = splittedDmgInfo.GetDamage();
2486
2487 // create procs
2488 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2489 caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted);
2490
2491 if (attacker)
2492 {
2493 attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo, splitted, splitSchoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2494 }
2495
2496 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2497 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, splitSchoolMask, splitSpellInfo, false);
2498 }
2499 }
2500}
double rand_norm()
Definition Random.cpp:77
@ POWER_MANA
Definition SharedDefines.h:269
@ SPELL_ATTR4_NO_CAST_LOG
Definition SharedDefines.h:530
SpellSchoolMask
Definition SharedDefines.h:295
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:297
@ SPELL_SCHOOL_MASK_NATURE
Definition SharedDefines.h:300
@ SPELL_SCHOOL_MASK_HOLY
Definition SharedDefines.h:298
@ SPELL_AURA_MANA_SHIELD
Definition SpellAuraDefines.h:160
@ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL
Definition SpellAuraDefines.h:257
@ SPELL_AURA_MOD_IGNORE_TARGET_RESIST
Definition SpellAuraDefines.h:332
@ SPELL_AURA_SPLIT_DAMAGE_FLAT
Definition SpellAuraDefines.h:216
@ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL
Definition SpellAuraDefines.h:258
@ SPELL_AURA_SPLIT_DAMAGE_PCT
Definition SpellAuraDefines.h:144
@ SPELL_AURA_SCHOOL_ABSORB
Definition SpellAuraDefines.h:132
@ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST
Definition SpellAuraDefines.h:333
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition SpellAuraDefines.h:394
@ SPELL_ATTR0_CU_BINARY_SPELL
Definition SpellInfo.h:196
@ SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC
Definition SpellInfo.h:199
@ PROC_EX_NORMAL_HIT
Definition SpellMgr.h:194
@ PROC_EX_IMMUNE
Definition SpellMgr.h:202
void createProcFlags(SpellInfo const *spellInfo, WeaponAttackType attackType, bool positive, uint32 &procAttacker, uint32 &procVictim)
Definition Unit.cpp:15943
@ DIRECT_DAMAGE
Definition Unit.h:248
@ MELEE_HIT_NORMAL
Definition Unit.h:286
T AddPct(T &base, U pct)
Definition Util.h:67
T RoundToInterval(T &num, T floor, T ceil)
Definition Util.h:79
Definition SpellAuraEffects.h:349
Definition SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo() const
Definition SpellAuraEffects.h:54
void SetAmount(int32 amount)
Definition SpellAuraEffects.h:66
Unit * GetCaster() const
Definition SpellAuraEffects.h:47
int32 GetMiscValue() const
Definition SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition SpellAuraEffects.h:49
uint32 GetEffIndex() const
Definition SpellAuraEffects.h:56
int32 GetAmount() const
Definition SpellAuraEffects.h:64
void CallScriptEffectAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition SpellAuras.cpp:2559
void CallScriptEffectAfterAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition SpellAuras.cpp:2577
void CallScriptEffectManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition SpellAuras.cpp:2591
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition SpellAuras.cpp:2605
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void ResistDamage(uint32 amount)
Definition Unit.cpp:158
void AbsorbDamage(uint32 amount)
Definition Unit.cpp:151
Unit * GetVictim() const
Definition Unit.h:359
Unit * GetAttacker() const
Definition Unit.h:358
SpellInfo const * GetSpellInfo() const
Definition Unit.h:360
DamageEffectType GetDamageType() const
Definition Unit.h:362
SpellSchoolMask GetSchoolMask() const
Definition Unit.h:361
uint32 GetDamage() const
Definition Unit.h:364
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2323
bool IsPositive() const
Definition SpellInfo.cpp:1237
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:14172
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1355
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition Unit.cpp:2031
static float GetEffectiveResistChance(Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
Definition Unit.cpp:2113
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition Unit.cpp:6333
void ProcDamageAndSpellFor(bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition Unit.cpp:16077
std::list< AuraEffect * > AuraEffectList
Definition Unit.h:652
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:12924
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition Unit.cpp:2147
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition Unit.cpp:810
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition Object.cpp:1327
Definition Unit.h:315

References DamageInfo::AbsorbDamage(), AddPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculatePct(), Aura::CallScriptEffectAbsorbHandlers(), Aura::CallScriptEffectAfterAbsorbHandlers(), Aura::CallScriptEffectAfterManaShieldHandlers(), Aura::CallScriptEffectManaShieldHandlers(), createProcFlags(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, SpellInfo::Effects, DamageInfo::GetAbsorb(), AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), DamageInfo::GetAttacker(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraApplication::GetBase(), AuraEffect::GetCaster(), DamageInfo::GetDamage(), DamageInfo::GetDamageType(), GetEffectiveResistChance(), AuraEffect::GetEffIndex(), Object::GetGUID(), SpellInfo::GetMaxRange(), AuraEffect::GetMiscValue(), DamageInfo::GetResist(), DamageInfo::GetSchoolMask(), DamageInfo::GetSpellInfo(), AuraEffect::GetSpellInfo(), DamageInfo::GetVictim(), SpellInfo::HasAttribute(), SpellInfo::Id, IsAlive(), Object::IsCreature(), IsImmunedToDamageOrSchool(), Object::IsInWorld(), SpellInfo::IsPositive(), WorldObject::IsWithinDist(), MELEE_HIT_NORMAL, ModifyPower(), POWER_MANA, PROC_EX_IMMUNE, PROC_EX_NORMAL_HIT, ProcDamageAndSpellFor(), rand_norm(), Aura::Remove(), DamageInfo::ResistDamage(), RoundToInterval(), SendSpellNonMeleeDamageLog(), AuraEffect::SetAmount(), SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC, SPELL_ATTR4_NO_CAST_LOG, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SPLIT_DAMAGE_FLAT, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NATURE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), DealDamage(), DealMeleeDamage(), Player::EnvironmentalDamage(), spell_valkyr_touch_aura::HandleEffectPeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcArmorReducedDamage()

uint32 Unit::CalcArmorReducedDamage ( Unit const *  attacker,
Unit const *  victim,
const uint32  damage,
SpellInfo const *  spellInfo,
uint8  attackerLevel = 0,
WeaponAttackType  attackType = MAX_ATTACK 
)
static
2032{
2033 float armor = float(victim->GetArmor());
2034
2035 // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
2036 if (attacker)
2037 {
2038 armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
2039
2040 if (spellInfo)
2041 if (Player* modOwner = attacker->GetSpellModOwner())
2042 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
2043
2044 AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
2045 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2046 {
2047 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
2048 && (*j)->IsAffectedOnSpell(spellInfo))
2049 armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
2050 }
2051
2052 AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
2053 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2054 {
2055 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
2056 armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
2057 }
2058
2059 // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
2060 if (attacker->IsPlayer())
2061 {
2062 float bonusPct = 0;
2063 AuraEffectList const& armorPenAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
2064 for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr)
2065 {
2066 if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
2067 {
2068 if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask())
2069 bonusPct += (*itr)->GetAmount();
2070 else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask())
2071 bonusPct += (*itr)->GetAmount();
2072 }
2073 else
2074 {
2075 if (attacker->ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
2076 bonusPct += (*itr)->GetAmount();
2077 }
2078 }
2079
2080 float maxArmorPen = 0;
2081 if (victim->GetLevel() < 60)
2082 maxArmorPen = float(400 + 85 * victim->GetLevel());
2083 else
2084 maxArmorPen = 400 + 85 * victim->GetLevel() + 4.5f * 85 * (victim->GetLevel() - 59);
2085
2086 // Cap armor penetration to this number
2087 maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
2088 // Figure out how much armor do we ignore
2089 float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
2090 // Got the value, apply it
2091 armor -= std::min(armorPen, maxArmorPen);
2092 }
2093 }
2094
2095 if (armor < 0.0f)
2096 armor = 0.0f;
2097
2098 float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
2099 if (levelModifier > 59)
2100 levelModifier = levelModifier + (4.5f * (levelModifier - 59));
2101
2102 float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40);
2103 tmpvalue = tmpvalue / (1.0f + tmpvalue);
2104
2105 if (tmpvalue < 0.0f)
2106 tmpvalue = 0.0f;
2107 if (tmpvalue > 0.75f)
2108 tmpvalue = 0.75f;
2109
2110 return uint32(std::ceil(std::max(damage * (1.0f - tmpvalue), 0.0f)));
2111}
@ SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
Definition SpellAuraDefines.h:343
@ SPELL_AURA_MOD_TARGET_RESISTANCE
Definition SpellAuraDefines.h:186
@ SPELLMOD_IGNORE_ARMOR
Definition SpellDefines.h:89
@ CR_ARMOR_PENETRATION
Definition Unit.h:241

References AddPct(), CalculatePct(), CR_ARMOR_PENETRATION, GetArmor(), GetAuraEffectsByType(), GetLevel(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), Player::HasItemFitToSpellRequirements(), SpellInfo::Id, Object::IsPlayer(), SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_IGNORE_ARMOR, and Object::ToPlayer().

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), boss_priestess_lackey_commonAI::GetThreatMod(), boss_faction_championsAI::GetThreatMod(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcHealAbsorb()

void Unit::CalcHealAbsorb ( HealInfo healInfo)
static
2503{
2504 if (!healInfo.GetHeal())
2505 return;
2506
2507 int32 const healing = static_cast<int32>(healInfo.GetHeal());
2508 int32 absorbAmount = 0;
2509
2510 // Need remove expired auras after
2511 bool existExpired = false;
2512
2513 // absorb without mana cost
2515 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end() && absorbAmount <= healing; ++i)
2516 {
2517 if (!((*i)->GetMiscValue() & healInfo.GetSpellInfo()->SchoolMask))
2518 continue;
2519
2520 // Max Amount can be absorbed by this aura
2521 int32 currentAbsorb = (*i)->GetAmount();
2522
2523 // Found empty aura (impossible but..)
2524 if (currentAbsorb <= 0)
2525 {
2526 existExpired = true;
2527 continue;
2528 }
2529
2530 // currentAbsorb - damage can be absorbed by shield
2531 // If need absorb less damage
2532 if (healing < currentAbsorb + absorbAmount)
2533 currentAbsorb = healing - absorbAmount;
2534
2535 absorbAmount += currentAbsorb;
2536
2537 // Reduce shield amount
2538 (*i)->SetAmount((*i)->GetAmount() - currentAbsorb);
2539 // Need remove it later
2540 if ((*i)->GetAmount() <= 0)
2541 existExpired = true;
2542 }
2543
2544 // Remove all expired absorb auras
2545 if (existExpired)
2546 {
2547 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end();)
2548 {
2549 AuraEffect* auraEff = *i;
2550 ++i;
2551 if (auraEff->GetAmount() <= 0)
2552 {
2553 uint32 removedAuras = healInfo.GetTarget()->m_removedAurasCount;
2555 if (removedAuras + 1 < healInfo.GetTarget()->m_removedAurasCount)
2556 i = vHealAbsorb.begin();
2557 }
2558 }
2559 }
2560
2561 if (absorbAmount > 0)
2562 healInfo.AbsorbHeal(absorbAmount);
2563}
@ SPELL_AURA_SCHOOL_HEAL_ABSORB
Definition SpellAuraDefines.h:364
SpellInfo const * GetSpellInfo() const
Definition Unit.h:415
void AbsorbHeal(uint32 amount)
Definition Unit.h:390
Unit * GetTarget() const
Definition Unit.h:411
uint32 GetHeal() const
Definition Unit.h:412
uint32 SchoolMask
Definition SpellInfo.h:392

References HealInfo::AbsorbHeal(), AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::GetAmount(), GetAuraEffectsByType(), AuraEffect::GetBase(), HealInfo::GetHeal(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), m_removedAurasCount, Aura::Remove(), SpellInfo::SchoolMask, and SPELL_AURA_SCHOOL_HEAL_ABSORB.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), and HealBySpell().

◆ CalcSpellDuration()

int32 Unit::CalcSpellDuration ( SpellInfo const *  spellProto)
14880{
14881 uint8 comboPoints = GetComboPoints();
14882
14883 int32 minduration = spellProto->GetDuration();
14884 int32 maxduration = spellProto->GetMaxDuration();
14885
14886 int32 duration;
14887
14888 if (comboPoints && minduration != -1 && minduration != maxduration)
14889 duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
14890 else
14891 duration = minduration;
14892
14893 return duration;
14894}
uint8 GetComboPoints(Unit const *who=nullptr) const
Definition Unit.h:964

References GetComboPoints(), SpellInfo::GetDuration(), and SpellInfo::GetMaxDuration().

Referenced by Aura::CalcMaxDuration(), Spell::EffectInterruptCast(), Spell::EffectSchoolDMG(), and Aura::HandleAuraSpecificMods().

◆ CalculateAOEDamageReduction()

int32 Unit::CalculateAOEDamageReduction ( int32  damage,
uint32  schoolMask,
Unit caster 
) const
20418{
20419 damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask));
20420 if (caster && caster->IsCreature())
20422
20423 return damage;
20424}
@ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE
Definition SpellAuraDefines.h:373
@ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
Definition SpellAuraDefines.h:292
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:5997

References GetTotalAuraMultiplierByMiscMask(), Object::IsCreature(), SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, and SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE.

Referenced by Spell::DoAllEffectOnLaunchTarget(), AuraEffect::HandlePeriodicDamageAurasTick(), and spell_dk_death_and_decay::RecalculateDamage().

◆ CalculateDamage()

uint32 Unit::CalculateDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
uint8  itemDamagesMask = 0 
)
2985{
2986 float minDamage = 0.0f;
2987 float maxDamage = 0.0f;
2988
2989 if (normalized || !addTotalPct || itemDamagesMask)
2990 {
2991 // get both by default
2992 if (!itemDamagesMask)
2993 {
2994 itemDamagesMask = (1 << 0) | (1 << 1);
2995 }
2996
2997 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2998 {
2999 if (itemDamagesMask & (1 << i))
3000 {
3001 float minTmp, maxTmp;
3002 CalculateMinMaxDamage(attType, normalized, addTotalPct, minTmp, maxTmp, i);
3003 minDamage += minTmp;
3004 maxDamage += maxTmp;
3005 }
3006 }
3007 }
3008 else
3009 {
3010 switch (attType)
3011 {
3012 case RANGED_ATTACK:
3015 break;
3016 case BASE_ATTACK:
3019 break;
3020 case OFF_ATTACK:
3023 break;
3024 default:
3025 break;
3026 }
3027 }
3028
3029 minDamage = std::max(0.f, minDamage);
3030 maxDamage = std::max(0.f, maxDamage);
3031
3032 if (minDamage > maxDamage)
3033 {
3034 std::swap(minDamage, maxDamage);
3035 }
3036
3037 return urand(uint32(minDamage), uint32(maxDamage));
3038}
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ UNIT_FIELD_MINDAMAGE
Definition UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition UpdateFields.h:128
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition UpdateFields.h:130
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition UpdateFields.h:169
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition UpdateFields.h:168
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition UpdateFields.h:129
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0

References BASE_ATTACK, CalculateMinMaxDamage(), Object::GetFloatValue(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, and urand().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ CalculateDefaultCoefficient()

float Unit::CalculateDefaultCoefficient ( SpellInfo const *  spellInfo,
DamageEffectType  damagetype 
) const
17220{
17221 // Damage over Time spells bonus calculation
17222 float DotFactor = 1.0f;
17223 if (damagetype == DOT)
17224 {
17225 int32 DotDuration = spellInfo->GetDuration();
17226 if (!spellInfo->IsChanneled() && DotDuration > 0)
17227 DotFactor = DotDuration / 15000.0f;
17228
17229 if (uint32 DotTicks = spellInfo->GetMaxTicks())
17230 DotFactor /= DotTicks;
17231 }
17232
17233 int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
17234 // Distribute Damage over multiple effects, reduce by AoE
17235 CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
17236
17237 // As wowwiki says: C = (Cast Time / 3.5)
17238 return (CastingTime / 3500.0f) * DotFactor;
17239}
@ DOT
Definition Unit.h:250
uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
Definition Unit.cpp:17101

References SpellInfo::CalcCastTime(), DOT, GetCastingTimeForBonus(), SpellInfo::GetDuration(), SpellInfo::GetMaxTicks(), and SpellInfo::IsChanneled().

Referenced by SpellDamageBonusTaken(), and SpellHealingBonusTaken().

◆ CalculateLevelPenalty()

float Unit::CalculateLevelPenalty ( SpellInfo const *  spellProto) const
3041{
3042 if (!IsPlayer())
3043 return 1.0f;
3044
3045 if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel)
3046 return 1.0f;
3047
3048 float LvlPenalty = 0.0f;
3049
3050 // xinef: added brackets
3051 if (spellProto->SpellLevel < 20)
3052 LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f;
3053
3054 float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(GetLevel());
3055 if (LvlFactor > 1.0f)
3056 LvlFactor = 1.0f;
3057
3058 return AddPct(LvlFactor, -LvlPenalty);
3059}
uint8 GetLevel() const
Definition Unit.h:1030

References AddPct(), GetLevel(), Object::IsPlayer(), SpellInfo::MaxLevel, and SpellInfo::SpellLevel.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellDamageBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), and SpellHealingBonusTaken().

◆ CalculateMeleeDamage()

void Unit::CalculateMeleeDamage ( Unit victim,
CalcDamageInfo damageInfo,
WeaponAttackType  attackType = BASE_ATTACK,
const bool  sittingVictim = false 
)
1465{
1466 damageInfo->attacker = this;
1467 damageInfo->target = victim;
1468
1469 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1470 {
1471 damageInfo->damages[i].damageSchoolMask = GetMeleeDamageSchoolMask(attackType, i);
1472 damageInfo->damages[i].damage = 0;
1473 damageInfo->damages[i].absorb = 0;
1474 damageInfo->damages[i].resist = 0;
1475 }
1476
1477 damageInfo->attackType = attackType;
1478 damageInfo->cleanDamage = 0;
1479 damageInfo->blocked_amount = 0;
1480
1481 damageInfo->TargetState = 0;
1482 damageInfo->HitInfo = 0;
1483 damageInfo->procAttacker = PROC_FLAG_NONE;
1484 damageInfo->procVictim = PROC_FLAG_NONE;
1485 damageInfo->procEx = PROC_EX_NONE;
1486 damageInfo->hitOutCome = MELEE_HIT_EVADE;
1487
1488 if (!victim)
1489 return;
1490
1491 if (!IsAlive() || !victim->IsAlive())
1492 return;
1493
1494 // Select HitInfo/procAttacker/procVictim flag based on attack type
1495 switch (attackType)
1496 {
1497 case BASE_ATTACK:
1500 break;
1501 case OFF_ATTACK:
1504 damageInfo->HitInfo = HITINFO_OFFHAND;
1505 break;
1506 default:
1507 return;
1508 }
1509
1510 // School Immune check
1511 uint8 immunedMask = 0;
1512 bool hasNonPhysicalSchoolMask = false;
1513 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1514 {
1516 {
1517 immunedMask |= (1 << i);
1519 {
1520 hasNonPhysicalSchoolMask = true;
1521 }
1522 }
1523 }
1524
1525 // School Immune check
1526 if (immunedMask & ((1 << 0) | (1 << 1)))
1527 {
1528 if (hasNonPhysicalSchoolMask || immunedMask == ((1 << 0) | (1 << 1)))
1529 {
1530 damageInfo->HitInfo |= HITINFO_NORMALSWING;
1531 damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
1532
1533 damageInfo->procEx |= PROC_EX_IMMUNE;
1534 return;
1535 }
1536 }
1537
1538 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1539 {
1540 // only players have secondary weapon damage
1541 if (i > 0 && !IsPlayer())
1542 {
1543 break;
1544 }
1545
1546 if (immunedMask & (1 << i))
1547 {
1548 continue;
1549 }
1550
1551 SpellSchoolMask schoolMask = SpellSchoolMask(damageInfo->damages[i].damageSchoolMask);
1552 bool const addPctMods = (schoolMask & SPELL_SCHOOL_MASK_NORMAL);
1553
1554 uint32 damage = 0;
1555 uint8 itemDamagesMask = (IsPlayer()) ? (1 << i) : 0;
1556
1557 damage += CalculateDamage(damageInfo->attackType, false, addPctMods, itemDamagesMask);
1558 // Add melee damage bonus
1559 damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType, nullptr, schoolMask);
1560 damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType, nullptr, schoolMask);
1561
1562 // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
1563 sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
1564
1565 if (victim->GetAI())
1566 {
1567 victim->GetAI()->OnCalculateMeleeDamageReceived(damage, this);
1568 }
1569
1570 // Calculate armor reduction
1572 {
1573 damageInfo->damages[i].damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, nullptr, 0, damageInfo->attackType);
1574 damageInfo->cleanDamage += damage - damageInfo->damages[i].damage;
1575 }
1576 else
1577 {
1578 damageInfo->damages[i].damage = damage;
1579 }
1580 }
1581
1582 damageInfo->hitOutCome = RollMeleeOutcomeAgainst(damageInfo->target, damageInfo->attackType);
1583
1584 // If the victim was a sitting player and we didn't roll a miss, then crit.
1585 if (sittingVictim && damageInfo->hitOutCome != MELEE_HIT_MISS)
1586 {
1587 damageInfo->hitOutCome = MELEE_HIT_CRIT;
1588 }
1589 switch (damageInfo->hitOutCome)
1590 {
1591 case MELEE_HIT_EVADE:
1593 damageInfo->TargetState = VICTIMSTATE_EVADES;
1594 damageInfo->procEx |= PROC_EX_EVADE;
1595
1596 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1597 {
1598 damageInfo->damages[i].damage = 0;
1599 }
1600
1601 damageInfo->cleanDamage = 0;
1602 return;
1603 case MELEE_HIT_MISS:
1604 damageInfo->HitInfo |= HITINFO_MISS;
1605 damageInfo->TargetState = VICTIMSTATE_INTACT;
1606 damageInfo->procEx |= PROC_EX_MISS;
1607
1608 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1609 {
1610 damageInfo->damages[i].damage = 0;
1611 }
1612 damageInfo->cleanDamage = 0;
1613 break;
1614 case MELEE_HIT_NORMAL:
1615 damageInfo->TargetState = VICTIMSTATE_HIT;
1616 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1617 break;
1618 case MELEE_HIT_CRIT:
1619 {
1620 damageInfo->HitInfo |= HITINFO_CRITICALHIT;
1621 damageInfo->TargetState = VICTIMSTATE_HIT;
1622
1623 damageInfo->procEx |= PROC_EX_CRITICAL_HIT;
1624 // Crit bonus calc
1625 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1626 {
1627 damageInfo->damages[i].damage *= 2;
1628
1629 float mod = 0.0f;
1630 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1631 if (damageInfo->attackType == RANGED_ATTACK)
1632 {
1634 }
1635 else
1636 {
1638
1639 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1641 }
1642
1643 uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask();
1644
1645 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1647 if (mod != 0)
1648 {
1649 AddPct(damageInfo->damages[i].damage, mod);
1650 }
1651 }
1652 break;
1653 }
1654 case MELEE_HIT_PARRY:
1655 damageInfo->TargetState = VICTIMSTATE_PARRY;
1656 damageInfo->procEx |= PROC_EX_PARRY;
1657 damageInfo->cleanDamage = 0;
1658
1659 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1660 {
1661 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1662 damageInfo->damages[i].damage = 0;
1663 }
1664 break;
1665 case MELEE_HIT_DODGE:
1666 damageInfo->TargetState = VICTIMSTATE_DODGE;
1667 damageInfo->procEx |= PROC_EX_DODGE;
1668 damageInfo->cleanDamage = 0;
1669
1670 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1671 {
1672 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1673 damageInfo->damages[i].damage = 0;
1674 }
1675 break;
1676 case MELEE_HIT_BLOCK:
1677 {
1678 damageInfo->TargetState = VICTIMSTATE_HIT;
1679 damageInfo->HitInfo |= HITINFO_BLOCK;
1680 damageInfo->procEx |= PROC_EX_BLOCK;
1681 damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue();
1682 // double blocked amount if block is critical
1683 if (damageInfo->target->isBlockCritical())
1684 damageInfo->blocked_amount += damageInfo->blocked_amount;
1685
1686 uint32 remainingBlock = damageInfo->blocked_amount;
1687 uint8 fullBlockMask = 0;
1688 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1689 {
1690 if (remainingBlock && remainingBlock >= damageInfo->damages[i].damage)
1691 {
1692 fullBlockMask |= (1 << i);
1693
1694 remainingBlock -= damageInfo->damages[i].damage;
1695 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1696 damageInfo->damages[i].damage = 0;
1697 }
1698 else
1699 {
1700 damageInfo->cleanDamage += remainingBlock;
1701 damageInfo->damages[i].damage -= remainingBlock;
1702 remainingBlock = 0;
1703 }
1704 }
1705
1706 // full block
1707 if (fullBlockMask == ((1 << 0) | (1 << 1)))
1708 {
1709 damageInfo->TargetState = VICTIMSTATE_BLOCKS;
1710 damageInfo->procEx |= PROC_EX_FULL_BLOCK;
1711 damageInfo->blocked_amount -= remainingBlock;
1712 }
1713 break;
1714 }
1715 case MELEE_HIT_GLANCING:
1716 {
1717 damageInfo->HitInfo |= HITINFO_GLANCING;
1718 damageInfo->TargetState = VICTIMSTATE_HIT;
1719 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1720 int32 leveldif = int32(victim->GetLevel()) - int32(GetLevel());
1721 if (leveldif > 3)
1722 leveldif = 3;
1723 float reducePercent = 1 - leveldif * 0.1f;
1724
1725 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1726 {
1727 uint32 reducedDamage = uint32(reducePercent * damageInfo->damages[i].damage);
1728 damageInfo->cleanDamage += damageInfo->damages[i].damage - reducedDamage;
1729 damageInfo->damages[i].damage = reducedDamage;
1730 }
1731 break;
1732 }
1733 case MELEE_HIT_CRUSHING:
1734 damageInfo->HitInfo |= HITINFO_CRUSHING;
1735 damageInfo->TargetState = VICTIMSTATE_HIT;
1736 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1737
1738 // 150% normal damage
1739 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1740 {
1741 damageInfo->damages[i].damage += (damageInfo->damages[i].damage / 2);
1742 }
1743 break;
1744 default:
1745 break;
1746 }
1747
1748 // Always apply HITINFO_AFFECTS_VICTIM in case its not a miss
1749 if (!(damageInfo->HitInfo & HITINFO_MISS))
1750 damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;
1751
1752 uint32 tmpHitInfo[MAX_ITEM_PROTO_DAMAGES] = { };
1753
1754 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1755 {
1756 int32 dmg = damageInfo->damages[i].damage;
1757 int32 cleanDamage = damageInfo->cleanDamage;
1758 // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here
1759 if (CanApplyResilience())
1760 {
1761 int32 resilienceReduction = damageInfo->damages[i].damage;
1762 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
1763
1764 resilienceReduction = damageInfo->damages[i].damage - resilienceReduction;
1765 dmg -= resilienceReduction;
1766 cleanDamage += resilienceReduction;
1767 }
1768
1769 damageInfo->damages[i].damage = std::max(0, dmg);
1770 damageInfo->cleanDamage = std::max(0, cleanDamage);
1771
1772 // Calculate absorb resist
1773 if (damageInfo->damages[i].damage > 0)
1774 {
1775 damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE;
1776
1777 // Calculate absorb & resists
1778 DamageInfo dmgInfo(*damageInfo, i);
1779 Unit::CalcAbsorbResist(dmgInfo);
1780 damageInfo->damages[i].absorb = dmgInfo.GetAbsorb();
1781 damageInfo->damages[i].resist = dmgInfo.GetResist();
1782
1783 if (damageInfo->damages[i].absorb)
1784 {
1785 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].absorb == 0 ? HITINFO_FULL_ABSORB : HITINFO_PARTIAL_ABSORB);
1786 }
1787
1788 if (damageInfo->damages[i].resist)
1789 {
1790 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].resist == 0 ? HITINFO_FULL_RESIST : HITINFO_PARTIAL_RESIST);
1791 }
1792
1793 damageInfo->damages[i].damage = dmgInfo.GetDamage();
1794 }
1795 }
1796
1797 // set proper HitInfo flags
1798 if ((tmpHitInfo[0] & HITINFO_FULL_ABSORB) != 0)
1799 {
1800 // set partial absorb when secondary damage isn't full absorbed
1801 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_ABSORB) != 0) ? HITINFO_PARTIAL_ABSORB : HITINFO_FULL_ABSORB;
1802 }
1803 else
1804 {
1805 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_ABSORB);
1806 }
1807
1808 if ((tmpHitInfo[0] & HITINFO_FULL_RESIST) != 0)
1809 {
1810 // set partial resist when secondary damage isn't full resisted
1811 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_RESIST) != 0) ? HITINFO_PARTIAL_RESIST : HITINFO_FULL_RESIST;
1812 }
1813 else
1814 {
1815 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_RESIST);
1816 }
1817
1819 {
1820 damageInfo->procEx |= PROC_EX_ABSORB;
1821 }
1822
1823 if (damageInfo->HitInfo & HITINFO_FULL_RESIST)
1824 {
1825 damageInfo->procEx |= PROC_EX_RESIST;
1826 }
1827}
@ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
Definition SpellAuraDefines.h:232
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE
Definition SpellAuraDefines.h:267
@ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
Definition SpellAuraDefines.h:226
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
Definition SpellAuraDefines.h:266
@ PROC_EX_NONE
Definition SpellMgr.h:193
@ PROC_EX_DODGE
Definition SpellMgr.h:198
@ PROC_EX_BLOCK
Definition SpellMgr.h:200
@ PROC_EX_CRITICAL_HIT
Definition SpellMgr.h:195
@ PROC_EX_MISS
Definition SpellMgr.h:196
@ PROC_EX_RESIST
Definition SpellMgr.h:197
@ PROC_EX_FULL_BLOCK
Definition SpellMgr.h:207
@ PROC_EX_ABSORB
Definition SpellMgr.h:204
@ PROC_EX_PARRY
Definition SpellMgr.h:199
@ PROC_EX_EVADE
Definition SpellMgr.h:201
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition SpellMgr.h:110
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition SpellMgr.h:140
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:137
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition SpellMgr.h:111
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition SpellMgr.h:141
@ PROC_FLAG_NONE
Definition SpellMgr.h:105
@ VICTIMSTATE_INTACT
Definition Unit.h:83
@ VICTIMSTATE_HIT
Definition Unit.h:84
@ VICTIMSTATE_DODGE
Definition Unit.h:85
@ VICTIMSTATE_IS_IMMUNE
Definition Unit.h:90
@ VICTIMSTATE_PARRY
Definition Unit.h:86
@ VICTIMSTATE_BLOCKS
Definition Unit.h:88
@ VICTIMSTATE_EVADES
Definition Unit.h:89
@ HITINFO_PARTIAL_ABSORB
Definition Unit.h:103
@ HITINFO_FULL_RESIST
Definition Unit.h:104
@ HITINFO_NORMALSWING
Definition Unit.h:96
@ HITINFO_BLOCK
Definition Unit.h:110
@ HITINFO_CRUSHING
Definition Unit.h:114
@ HITINFO_SWINGNOHITSOUND
Definition Unit.h:118
@ HITINFO_MISS
Definition Unit.h:101
@ HITINFO_FULL_ABSORB
Definition Unit.h:102
@ HITINFO_OFFHAND
Definition Unit.h:99
@ HITINFO_GLANCING
Definition Unit.h:113
@ HITINFO_CRITICALHIT
Definition Unit.h:106
@ HITINFO_PARTIAL_RESIST
Definition Unit.h:105
@ HITINFO_AFFECTS_VICTIM
Definition Unit.h:98
@ MELEE_HIT_CRUSHING
Definition Unit.h:286
@ MELEE_HIT_BLOCK
Definition Unit.h:285
@ MELEE_HIT_CRIT
Definition Unit.h:286
@ MELEE_HIT_EVADE
Definition Unit.h:285
@ MELEE_HIT_DODGE
Definition Unit.h:285
@ MELEE_HIT_MISS
Definition Unit.h:285
@ MELEE_HIT_PARRY
Definition Unit.h:285
@ MELEE_HIT_GLANCING
Definition Unit.h:286
virtual void OnCalculateMeleeDamageReceived(uint32 &, Unit *)
Called during damage calculations.
Definition UnitAI.h:381
bool isBlockCritical()
Definition Unit.cpp:3126
uint32 MeleeDamageBonusTaken(Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:13299
virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:5984
bool CanApplyResilience() const
Definition Unit.h:1099
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
Definition Unit.cpp:2984
virtual uint32 GetShieldBlockValue() const =0
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition Unit.cpp:18950
UnitAI * GetAI()
Definition Unit.h:664
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition Unit.cpp:2008
int32 GetTotalAuraModifier(AuraType auratype) const
Definition Unit.cpp:5933
MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const *victim, WeaponAttackType attType) const
Definition Unit.cpp:2781
uint32 GetCreatureTypeMask() const
Definition Unit.h:791
uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:13097
uint32 damageSchoolMask
Definition Unit.h:469
uint32 blocked_amount
Definition Unit.h:475
MeleeHitOutcome hitOutCome
Definition Unit.h:484
uint32 cleanDamage
Definition Unit.h:483
uint32 TargetState
Definition Unit.h:477
uint32 resist
Definition Unit.h:472
uint32 HitInfo
Definition Unit.h:476

References CalcDamageInfo::absorb, AddPct(), ApplyResilience(), CalcDamageInfo::attacker, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculateDamage(), CanApplyResilience(), CalcDamageInfo::cleanDamage, CR_CRIT_TAKEN_MELEE, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), GetLevel(), GetMeleeDamageSchoolMask(), DamageInfo::GetResist(), GetShieldBlockValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplierByMiscMask(), CalcDamageInfo::HitInfo, HITINFO_AFFECTS_VICTIM, HITINFO_BLOCK, HITINFO_CRITICALHIT, HITINFO_CRUSHING, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_GLANCING, HITINFO_MISS, HITINFO_NORMALSWING, HITINFO_OFFHAND, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_SWINGNOHITSOUND, CalcDamageInfo::hitOutCome, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), IsImmunedToDamageOrSchool(), Object::IsPlayer(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, MeleeDamageBonusDone(), MeleeDamageBonusTaken(), OFF_ATTACK, UnitAI::OnCalculateMeleeDamageReceived(), PROC_EX_ABSORB, PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_EVADE, PROC_EX_FULL_BLOCK, PROC_EX_IMMUNE, PROC_EX_MISS, PROC_EX_NONE, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_RESIST, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_NONE, PROC_FLAG_TAKEN_DAMAGE, PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, CalcDamageInfo::procAttacker, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, RANGED_ATTACK, CalcDamageInfo::resist, RollMeleeOutcomeAgainst(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, CalcDamageInfo::target, CalcDamageInfo::TargetState, VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, VICTIMSTATE_EVADES, VICTIMSTATE_HIT, VICTIMSTATE_INTACT, VICTIMSTATE_IS_IMMUNE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ CalculateMinMaxDamage()

virtual void Unit::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex = 0 
)
pure virtual

Implemented in Creature, and Player.

Referenced by CalculateDamage(), and UpdateDamagePhysical().

◆ CalculateSpellDamage()

int32 Unit::CalculateSpellDamage ( Unit const *  target,
SpellInfo const *  spellProto,
uint8  effect_index,
int32 const *  basePoints = nullptr 
) const

◆ CalculateSpellDamageTaken()

void Unit::CalculateSpellDamageTaken ( SpellNonMeleeDamage damageInfo,
int32  damage,
SpellInfo const *  spellInfo,
WeaponAttackType  attackType = BASE_ATTACK,
bool  crit = false 
)
1296{
1297 if (damage < 0)
1298 return;
1299
1300 Unit* victim = damageInfo->target;
1301 if (!victim || !victim->IsAlive())
1302 return;
1303
1304 SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
1305 uint32 crTypeMask = victim->GetCreatureTypeMask();
1306
1307 // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
1308 sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo);
1309
1310 if (victim->GetAI())
1311 {
1312 victim->GetAI()->OnCalculateSpellDamageReceived(damage, this);
1313 }
1314
1315 int32 cleanDamage = 0;
1316 if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo))
1317 {
1318 int32 oldDamage = damage;
1319 damage = Unit::CalcArmorReducedDamage(this, victim, damage, spellInfo, 0, attackType);
1320 cleanDamage = oldDamage - damage;
1321 }
1322
1323 bool blocked = false;
1324 // Per-school calc
1325 switch (spellInfo->DmgClass)
1326 {
1327 // Melee and Ranged Spells
1330 {
1331 // Physical Damage
1332 if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
1333 {
1334 // Get blocked status
1335 blocked = isSpellBlocked(victim, spellInfo, attackType);
1336 }
1337
1338 if (crit)
1339 {
1340 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1341
1342 // Calculate crit bonus
1343 uint32 crit_bonus = damage;
1344 // Apply crit_damage bonus for melee spells
1345 if (Player* modOwner = GetSpellModOwner())
1346 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
1347 damage += crit_bonus;
1348
1349 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1350 float critPctDamageMod = 0.0f;
1351 if (attackType == RANGED_ATTACK)
1353 else
1355
1356 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1357 critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask());
1358
1359 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1361
1362 if (critPctDamageMod != 0)
1363 AddPct(damage, critPctDamageMod);
1364 }
1365
1366 // Spell weapon based damage CAN BE crit & blocked at same time
1367 if (blocked)
1368 {
1369 damageInfo->blocked = victim->GetShieldBlockValue();
1370 // double blocked amount if block is critical
1371 if (victim->isBlockCritical())
1372 damageInfo->blocked *= 2;
1373 if (damage < int32(damageInfo->blocked))
1374 damageInfo->blocked = uint32(damage);
1375
1376 damage -= damageInfo->blocked;
1377 cleanDamage += damageInfo->blocked;
1378 }
1379
1380 int32 resilienceReduction = damage;
1381 if (CanApplyResilience())
1382 {
1383 if (attackType != RANGED_ATTACK)
1384 {
1385 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_MELEE);
1386 }
1387 else
1388 {
1389 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_RANGED);
1390 }
1391 }
1392
1393 resilienceReduction = damage - resilienceReduction;
1394 damage -= resilienceReduction;
1395 cleanDamage += resilienceReduction;
1396 break;
1397 }
1398 // Magical Attacks
1401 {
1402 // If crit add critical bonus
1403 if (crit)
1404 {
1405 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1406 damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim);
1407 }
1408
1409 int32 resilienceReduction = damage;
1410 if (CanApplyResilience())
1411 {
1412 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
1413 }
1414
1415 resilienceReduction = damage - resilienceReduction;
1416 damage -= resilienceReduction;
1417 cleanDamage += resilienceReduction;
1418 break;
1419 }
1420 default:
1421 break;
1422 }
1423
1424 damageInfo->cleanDamage = std::max(0, cleanDamage);
1425 damageInfo->damage = std::max(0, damage);
1426
1427 // Calculate absorb resist
1428 if (damageInfo->damage > 0)
1429 {
1430 DamageInfo dmgInfo(*damageInfo, SPELL_DIRECT_DAMAGE);
1431 Unit::CalcAbsorbResist(dmgInfo);
1432 damageInfo->absorb = dmgInfo.GetAbsorb();
1433 damageInfo->resist = dmgInfo.GetResist();
1434 damageInfo->damage = dmgInfo.GetDamage();
1435 }
1436}
@ SPELL_DAMAGE_CLASS_RANGED
Definition SharedDefines.h:1548
@ SPELL_DAMAGE_CLASS_MAGIC
Definition SharedDefines.h:1546
@ SPELL_DAMAGE_CLASS_NONE
Definition SharedDefines.h:1545
@ SPELL_DAMAGE_CLASS_MELEE
Definition SharedDefines.h:1547
@ SPELL_HIT_TYPE_CRIT
Definition SharedDefines.h:1536
@ SPELLMOD_CRIT_DAMAGE_BONUS
Definition SpellDefines.h:91
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:249
virtual void OnCalculateSpellDamageReceived(int32 &, Unit *)
Definition UnitAI.h:382
bool isSpellBlocked(Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
Definition Unit.cpp:3100
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition Unit.cpp:12304
Unit * target
Definition Unit.h:495
uint32 HitInfo
Definition Unit.h:506
uint32 damage
Definition Unit.h:498
uint32 absorb
Definition Unit.h:501
Unit * attacker
Definition Unit.h:496
uint32 schoolMask
Definition Unit.h:500
uint32 cleanDamage
Definition Unit.h:508
uint32 resist
Definition Unit.h:502
uint32 blocked
Definition Unit.h:505

References SpellNonMeleeDamage::absorb, AddPct(), ApplyResilience(), SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CalcAbsorbResist(), CalcArmorReducedDamage(), CanApplyResilience(), SpellNonMeleeDamage::cleanDamage, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, SpellNonMeleeDamage::damage, SpellInfo::DmgClass, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), DamageInfo::GetResist(), SpellInfo::GetSchoolMask(), GetShieldBlockValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), isSpellBlocked(), UnitAI::OnCalculateSpellDamageReceived(), RANGED_ATTACK, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_DIRECT_DAMAGE, SPELL_HIT_TYPE_CRIT, SPELL_SCHOOL_MASK_NORMAL, SpellCriticalDamageBonus(), SPELLMOD_CRIT_DAMAGE_BONUS, sScriptMgr, and SpellNonMeleeDamage::target.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ CanApplyResilience()

bool Unit::CanApplyResilience ( ) const
inline

◆ CanDualWield()

◆ CanEnterWater()

virtual bool Unit::CanEnterWater ( ) const
pure virtual

Implemented in Creature, and Player.

◆ CanFly()

◆ CanFreeMove()

bool Unit::CanFreeMove ( ) const
inline
1640 {
1643 }
@ UNIT_STATE_DISTRACTED
Definition UnitDefines.h:182
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:181
@ UNIT_STATE_FLEEING
Definition UnitDefines.h:177
@ UNIT_STATE_IN_FLIGHT
Definition UnitDefines.h:178
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173

References GetOwnerGUID(), HasUnitState(), UNIT_STATE_CONFUSED, UNIT_STATE_DISTRACTED, UNIT_STATE_FLEEING, UNIT_STATE_IN_FLIGHT, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by Creature::IsFreeToMove().

◆ CanHaveThreatList()

bool Unit::CanHaveThreatList ( bool  skipAliveCheck = false) const
14638{
14639 // only creatures can have threat list
14640 if (!IsCreature())
14641 return false;
14642
14643 // only alive units can have threat list
14644 if (!skipAliveCheck && !IsAlive())
14645 return false;
14646
14647 // totems can not have threat list
14648 if (ToCreature()->IsTotem())
14649 return false;
14650
14651 // vehicles can not have threat list
14652 if (ToCreature()->IsVehicle() && GetMap()->IsBattlegroundOrArena())
14653 return false;
14654
14655 // summons can not have a threat list, unless they are controlled by a creature
14657 return false;
14658
14659 return true;
14660}
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition UnitDefines.h:164
@ UNIT_MASK_GUARDIAN
Definition UnitDefines.h:158
bool IsVehicle() const
Definition Unit.h:763
Map * GetMap() const
Definition Object.h:536

References WorldObject::GetMap(), GetOwnerGUID(), HasUnitTypeMask(), IsAlive(), Object::IsCreature(), Object::IsPlayer(), IsTotem(), IsVehicle(), Object::ToCreature(), UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_MASK_GUARDIAN, and UNIT_MASK_MINION.

Referenced by AddThreat(), Creature::CanPeriodicallyCallForAssistance(), ThreatMgr::ClearAllThreat(), DealDamage(), ScriptedAI::DoResetThreatList(), CreatureAI::DoZoneInCombat(), Spell::EffectTaunt(), Spell::EffectThreat(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleModTaunt(), Spell::HandleThreatSpells(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), Creature::SelectVictim(), TauntApply(), TauntFadeOut(), and Update().

◆ CanInstantCast()

bool Unit::CanInstantCast ( ) const
inline
1509{ return _instantCast; }

References _instantCast.

Referenced by ModSpellCastTime().

◆ CanModifyStats()

◆ CanProc()

bool Unit::CanProc ( )
inline
1480{ return !m_procDeep; }

References m_procDeep.

Referenced by Spell::DoAllEffectOnTarget().

◆ CanRestoreMana()

bool Unit::CanRestoreMana ( SpellInfo const *  spellInfo) const
21256{
21257 // Aura of Despair exceptions
21258 switch (spellInfo->Id)
21259 {
21260 case 16666: // Demonic Rune
21261 case 27869: // Dark Rune
21262 case 30824: // Shamanistic Rage
21263 case 31786: // Spiritual Attunement
21264 case 31930: // Judgements of the Wise
21265 case 34075: // Aspect of the Viper
21266 case 34720: // Thrill of the hunt
21267 case 47755: // Rapture
21268 case 54425: // Improved Felhunter
21269 case 57319: // Blessing of Sanctuary
21270 case 63337: // Saronite Vapors (regenerate mana)
21271 case 63375: // Improved stormstrike
21272 case 64372: // Lifebloom
21273 case 68285: // Improved Leader of the Pack
21274 return true;
21275 case 54428: // Divine Plea - only with talent Guarded by the Light
21276 return HasSpell(53583);
21277 default:
21278 break;
21279 }
21280
21281 return false;
21282}
virtual bool HasSpell(uint32) const
Definition Unit.h:1504

References HasSpell(), and SpellInfo::Id.

Referenced by IsImmunedToSpellEffect().

◆ CanSwim()

bool Unit::CanSwim ( ) const
virtual

this method checks the current flag of a unit

These flags can be set within the database or dynamically changed at runtime UNIT_FLAG_SWIMMING must be updated when a unit enters a swimmable area

Reimplemented in Creature.

19989{
19990 // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
19992 return false;
19994 return true;
19996 return false;
19998 return true;
20000}
@ UNIT_FLAG2_UNUSED_6
Definition UnitDefines.h:307
@ UNIT_FLAG_CANNOT_SWIM
Definition UnitDefines.h:264
@ UNIT_FLAG_POSSESSED
Definition UnitDefines.h:274
@ UNIT_FLAG_SWIMMING
Definition UnitDefines.h:265
@ UNIT_FLAG_RENAME
Definition UnitDefines.h:254
@ UNIT_FLAG_PET_IN_COMBAT
Definition UnitDefines.h:261
bool HasUnitFlag2(UnitFlags2 flags) const
Definition Unit.h:724

References HasUnitFlag(), HasUnitFlag2(), UNIT_FLAG2_UNUSED_6, UNIT_FLAG_CANNOT_SWIM, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_POSSESSED, UNIT_FLAG_RENAME, and UNIT_FLAG_SWIMMING.

Referenced by PathGenerator::BuildPolyPath(), and Creature::CanSwim().

◆ CanUseAttackType()

◆ CastCustomSpell() [1/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
CustomSpellValues const &  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1251{
1252 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1253 if (!spellInfo)
1254 {
1255 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1257 }
1258
1259 SpellCastTargets targets;
1260 targets.SetUnitTarget(victim);
1261
1262 return CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
1263}
#define LOG_ERROR(filterType__,...)
Definition Log.h:157
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition SharedDefines.h:1056
Definition Spell.h:111
void SetUnitTarget(Unit *target)
Definition Spell.cpp:239

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetUnitTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastCustomSpell() [2/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1237{
1238 CustomSpellValues values;
1239 values.AddSpellMod(mod, value);
1240 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1241}
@ TRIGGERED_NONE
Definition SpellDefines.h:133
Definition SpellDefines.h:165
void AddSpellMod(SpellValueMod mod, int32 value)
Definition SpellDefines.h:167
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1224

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastCustomSpell() [3/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1244{
1245 CustomSpellValues values;
1246 values.AddSpellMod(mod, value);
1247 return CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
1248}

References CustomSpellValues::AddSpellMod(), and CastCustomSpell().

◆ CastCustomSpell() [4/4]

SpellCastResult Unit::CastCustomSpell ( Unit victim,
uint32  spellId,
int32 const *  bp0,
int32 const *  bp1,
int32 const *  bp2,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1225{
1226 CustomSpellValues values;
1227 if (bp0)
1228 values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0);
1229 if (bp1)
1230 values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
1231 if (bp2)
1232 values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
1233 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1234}
@ SPELLVALUE_BASE_POINT1
Definition SpellDefines.h:114
@ SPELLVALUE_BASE_POINT2
Definition SpellDefines.h:115
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), SPELLVALUE_BASE_POINT0, SPELLVALUE_BASE_POINT1, SPELLVALUE_BASE_POINT2, TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

Referenced by spell_pri_guardian_spirit::Absorb(), spell_mage_fire_frost_ward::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump_aura::AfterDispel(), spell_dru_lifebloom::AfterRemove(), Player::ApplyEnchantment(), Player::ApplyEquipSpell(), CastCustomSpell(), CastCustomSpell(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), npc_gas_cloud::npc_gas_cloudAI::CastMainSpell(), CastPetAura(), spell_ruby_sanctum_rallying_shout::CountAllies(), spell_igb_rocket_artillery_explosion::DamageGunship(), boss_illidari_council_memberAI::DamageTaken(), boss_leotheras_the_blind::DemonTime(), spell_warl_seed_of_corruption_generic_aura::Detonate(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), Spell::EffectDestroyAllTotems(), Spell::EffectDispel(), Spell::EffectFeedPet(), Spell::EffectForceCast(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonType(), EnterVehicle(), EnterVehicleUnattackable(), AuraMunchingQueue::Execute(), TriggerWickedSpirit::Execute(), spell_sha_totem_of_wrath::HandleAfterCast(), spell_reflective_shield_aura::HandleAfterEffectAbsorb(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraProc(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_pri_shadow_word_death::HandleDamage(), spell_dk_corpse_explosion::HandleDamage(), spell_dru_lifebloom::HandleDispel(), spell_igb_burning_pitch::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_deathbringer_blood_link::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_gen_dummy_trigger::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_pal_divine_storm_dummy::HandleDummy(), spell_sha_ancestral_awakening_proc::HandleDummy(), spell_sha_cleansing_totem_pulse::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_last_stand::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_slam::HandleDummy(), spell_warr_bloodthirst::HandleDummy(), HandleDummyAuraProc(), spell_egg_explosion::HandleDummyHitTarget(), spell_warr_execute::HandleEffect(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_serpentshrine_cavern_infection::HandleEffectRemove(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_ragin_flames_inferno::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_deathbringer_blood_link_aura::HandleProc(), spell_deathbringer_blood_link_blood_beast_aura::HandleProc(), spell_reliquary_of_souls_aura_of_desire_aura::HandleProc(), spell_black_temple_consuming_strikes_aura::HandleProc(), spell_item_blade_ward_enchant::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_dru_living_seed_proc::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_the_lich_king_dark_hunger_aura::HandleProc(), spell_yogg_saron_grim_reprisal_aura::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_dk_blood_gorged::HandleProc(), spell_dru_living_seed::HandleProc(), spell_gen_blade_warding::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_mage_burnout::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_rog_blade_flurry::HandleProc(), spell_sha_item_mana_surge::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleProcTriggerSpellWithValueAuraProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_igb_rocket_pack_aura::HandleRemove(), spell_warl_haunt_aura::HandleRemove(), spell_pal_lay_on_hands::HandleScript(), spell_kelthuzad_detonate_mana_aura::HandleScript(), spell_q12919_gymers_grab::HandleScript(), spell_gluth_decimate::HandleScriptEffect(), spell_hun_chimera_shot::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), spell_illidari_council_circle_of_healing::HandleSharedRule(), HandleSpellClick(), spell_halion_damage_aoe_summon::HandleSummon(), spell_putricide_mutated_transformation::HandleSummon(), spell_putricide_mutated_plague_aura::HandleTriggerSpell(), boss_sathrovarr::JustEngagedWith(), boss_essence_of_suffering::boss_essence_of_sufferingAI::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_felblood_kaelthas::JustEngagedWith(), boss_alythess::JustEngagedWith(), boss_kalecgos::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_mother_shahraz::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_najentus::JustEngagedWith(), boss_morogrim_tidewalker::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_janalai_hatcher::MovementInform(), npc_frost_tomb::npc_frost_tomb(), spell_dru_tiger_s_fury::OnHit(), spell_gen_flurry_of_claws::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen_aura::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warr_improved_spell_reflection::OnProc(), spell_warr_damage_shield::OnProc(), spell_kalecgos_curse_of_boundless_agony_aura::OnRemove(), spell_halion_marks_aura::OnRemove(), spell_putricide_mutated_plague_aura::OnRemove(), spell_the_lich_king_necrotic_plague_aura::OnRemove(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), spell_sindragosa_instability_aura::OnRemove(), spell_the_lich_king_necrotic_plague_jump_aura::OnRemove(), spell_karazhan_overload_aura::PeriodicTick(), spell_entropius_negative_energy_periodic::PeriodicTick(), spell_doomfire::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick(), spell_broggok_poison_cloud::PeriodicTick(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11198_take_down_tethyr::PrepareSpellScript(), SmartScript::ProcessAction(), spell_illidari_council_reflective_shield_aura::ReflectDamage(), spell_pri_power_word_shield_aura::ReflectDamage(), boss_kiljaeden::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), boss_magtheridon::ScheduleCombatEvents(), boss_felmyst::ScheduleFlightSequence(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), boss_viscidus::SummonedCreatureDies(), spell_dk_anti_magic_shell_self::Trigger(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), spell_the_lich_king_life_siphon::TriggerHeal(), spell_pal_divine_storm::TriggerHeal(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), npc_coren_direbrew::UpdateAI(), boss_huhuran::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_living_constellation::npc_living_constellationAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), and boss_toravon::boss_toravonAI::UpdateAI().

◆ CastDelayedSpellWithPeriodicAmount()

void Unit::CastDelayedSpellWithPeriodicAmount ( Unit caster,
uint32  spellId,
AuraType  auraType,
int32  addAmount,
uint8  effectIndex = 0 
)
20330{
20331 AuraEffect* aurEff = nullptr;
20332 for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
20333 {
20334 aurEff = *i;
20335 if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
20336 continue;
20337
20338 addAmount += ((aurEff->GetOldAmount() * std::max<int32>(aurEff->GetTotalTicks() - int32(aurEff->GetTickNumber()), 0)) / aurEff->GetTotalTicks());
20339 break;
20340 }
20341
20342 // xinef: delay only for casting on different unit
20343 if (this == caster || !sWorld->getBoolConfig(CONFIG_MUNCHING_BLIZZLIKE))
20344 caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, aurEff, caster->GetGUID());
20345 else
20346 caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId, aurEff, auraType), caster->m_Events.CalculateQueueTime(400));
20347}
@ CONFIG_MUNCHING_BLIZZLIKE
Definition IWorld.h:184
TriggerCastFlags
Definition SpellDefines.h:132
@ TRIGGERED_NO_PERIODIC_RESET
Will ignore equipped item requirements.
Definition SpellDefines.h:152
uint32 GetTickNumber() const
Definition SpellAuraEffects.h:87
int32 GetOldAmount() const
Definition SpellAuraEffects.h:116
uint32 GetId() const
Definition SpellAuraEffects.cpp:432
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7370
ObjectGuid GetCasterGUID() const
Definition SpellAuraEffects.h:48
Definition Unit.cpp:20296
uint64 CalculateQueueTime(uint64 delay) const
Definition EventProcessor.cpp:164

References EventProcessor::AddEvent(), EventProcessor::CalculateQueueTime(), CastCustomSpell(), CONFIG_MUNCHING_BLIZZLIKE, AuraEffect::GetCasterGUID(), AuraEffect::GetEffIndex(), Object::GetGUID(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetOldAmount(), AuraEffect::GetTickNumber(), AuraEffect::GetTotalTicks(), WorldObject::m_Events, m_modAuras, SPELLVALUE_BASE_POINT0, sWorld, TRIGGERED_FULL_MASK, and TRIGGERED_NO_PERIODIC_RESET.

Referenced by HandleDummyAuraProc(), spell_mage_ignite::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_sha_t8_electrified::HandleProc(), and HandleProcTriggerSpell().

◆ CastPetAura()

void Unit::CastPetAura ( PetAura const *  aura)
17345{
17346 uint32 auraId = aura->GetAura(GetEntry());
17347 if (!auraId)
17348 return;
17349
17350 if (auraId == 35696) // Demonic Knowledge
17351 {
17352 int32 basePoints = aura->GetDamage();
17353 CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true);
17354 }
17355 else
17356 CastSpell(this, auraId, true);
17357}

References CastCustomSpell(), CastSpell(), PetAura::GetAura(), PetAura::GetDamage(), and Object::GetEntry().

Referenced by Pet::CastPetAuras().

◆ CastSpell() [1/7]

SpellCastResult Unit::CastSpell ( float  x,
float  y,
float  z,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1266{
1267 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1268 if (!spellInfo)
1269 {
1270 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1272 }
1273
1274 SpellCastTargets targets;
1275 targets.SetDst(x, y, z, GetOrientation());
1276
1277 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1278}
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition Spell.cpp:406

References CastSpell(), Object::GetGUID(), Position::GetOrientation(), LOG_ERROR, SpellCastTargets::SetDst(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [2/7]

SpellCastResult Unit::CastSpell ( GameObject go,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1281{
1282 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1283 if (!spellInfo)
1284 {
1285 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1287 }
1288
1289 SpellCastTargets targets;
1290 targets.SetGOTarget(go);
1291
1292 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1293}
void SetGOTarget(GameObject *target)
Definition Spell.cpp:271

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetGOTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [3/7]

SpellCastResult Unit::CastSpell ( SpellCastTargets const &  targets,
SpellInfo const *  spellInfo,
CustomSpellValues const *  value,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
Todo:
: this is a workaround - not needed anymore, but required for some scripts :(
1168{
1169 if (!spellInfo)
1170 {
1171 LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster {}", GetGUID().ToString());
1173 }
1174
1176 if (!originalCaster && triggeredByAura)
1177 {
1178 originalCaster = triggeredByAura->GetCasterGUID();
1179 }
1180
1181 Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster);
1182
1183 if (value)
1184 {
1185 for (CustomSpellValues::const_iterator itr = value->begin(); itr != value->end(); ++itr)
1186 {
1187 spell->SetSpellValue(itr->first, itr->second);
1188 }
1189 }
1190
1191 spell->m_CastItem = castItem;
1192 return spell->prepare(&targets, triggeredByAura);
1193}
void SetSpellValue(SpellValueMod mod, int32 value)
Definition Spell.cpp:8437
Item * m_CastItem
Definition Spell.h:524

References AuraEffect::GetCasterGUID(), Object::GetGUID(), LOG_ERROR, Spell::m_CastItem, Spell::prepare(), Spell::SetSpellValue(), SPELL_FAILED_SPELL_UNAVAILABLE, and Position::ToString().

Referenced by Player::_addSpell(), Player::_addTalentAurasAndSpells(), Spell::_cast(), _ExitVehicle(), Player::_LoadGlyphAuras(), Battleground::_ProcessResurrect(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_rog_cheat_death::Absorb(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Player::ActivateSpec(), spell_halion_combustion_consumption_aura::AddMarkStack(), Battleground::AddPlayer(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), BattlegroundMap::AddPlayerToMap(), Battleground::AddPlayerToResurrectQueue(), Pet::addSpell(), spell_dru_barkskin::AfterApply(), spell_dru_savage_roar_aura::AfterApply(), spell_astromancer_wrath_of_the_astromancer::AfterRemove(), spell_gen_lifebloom::AfterRemove(), spell_oculus_stop_time_aura::Apply(), spell_sha_earthbind_totem::Apply(), spell_warl_health_funnel::ApplyEffect(), Player::ApplyEnchantment(), spell_hun_lock_and_load::ApplyMarker(), npc_mograine::npc_mograineAI::AshbringerEvent(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::boss_yoggsaron_crusher_tentacleAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::boss_yoggsaron_death_orbAI(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::boss_yoggsaron_influence_tentacleAI(), WorldState::BuffAdalsSongOfBattle(), WorldState::BuffMagtheridonTeam(), Player::BuildPlayerRepop(), spell_igb_incinerating_blast::CalculateDamage(), spell_igb_cannon_blast::CalculatePower(), npc_echo_of_medivh::CastChangeFacing(), npc_chesspiece::CastChangeFacing(), CastCustomSpell(), npc_hallows_end_soh::CastFires(), Player::CastItemCombatSpell(), npc_volatile_ooze::npc_volatile_oozeAI::CastMainSpell(), CastPetAura(), boss_mor_grayhoof::CastRandomSpell(), CastSpell(), CastSpell(), GameObject::CastSpell(), CastSpell(), CastSpell(), CastSpell(), CastSpell(), spell_the_lich_king_defile::ChangeDamageAndGrow(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), spell_eredar_twins_handle_touch::CheckCast(), Spell::CheckCast(), Spell::CheckItems(), spell_botanica_shift_form_aura::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), spell_the_lich_king_shadow_trap_periodic::CheckTargetCount(), spell_dk_raise_dead::ConsumeReagents(), spell_frost_giant_death_plague::CountTargets(), instance_blackrock_spire::instance_blackrock_spireMapScript::CreatureLooted(), violet_hold_trashAI::CreatureStartAttackDoor(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), npc_collapsing_star::npc_collapsing_starAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), DealDamage(), DealMeleeDamage(), spell_warl_seed_of_corruption_aura::Detonate(), spell_warl_seed_of_corruption_generic_aura::Detonate(), boss_twin_valkyrAI::DoAction(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), npc_eris_hevenfire::npc_eris_hevenfireAI::DoAction(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_flame_leviathan::boss_flame_leviathanAI::DoAction(), boss_magtheridon::DoAction(), boss_sacrolash::DoAction(), boss_alythess::DoAction(), npc_kalecgos_kj::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_black_knight::boss_black_knightAI::DoAction(), boss_jormungarAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_icc_blood_beast::npc_icc_blood_beastAI::DoAction(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_molten_golem::npc_molten_golemAI::DoAction(), boss_steelbreaker::boss_steelbreakerAI::DoAction(), npc_ulduar_bot_summon_trigger::npc_ulduar_bot_summon_triggerAI::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DoAction(), boss_yoggsaron_keeper::DoAction(), Spell::DoAllEffectOnTarget(), UnitAI::DoCast(), UnitAI::DoCast(), UnitAI::DoCastAOE(), ScriptedAI::DoCastSpell(), InstanceScript::DoCastSpellOnPlayer(), InstanceScript::DoCastSpellOnPlayers(), UnitAI::DoCastToAllHostilePlayers(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), npc_midsummer_ribbon_pole_target::DoFireworkChecks(), npc_midsummer_ribbon_pole_target::DoGroundFlowerChecks(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), npc_midsummer_ribbon_pole_target::DoSpewLavaChecks(), boss_skeram::DoTeleport(), Spell::DoTriggersOnSpellHit(), Player::DuelComplete(), Spell::EffectActivateRune(), Spell::EffectApplyGlyph(), Spell::EffectCastButtons(), Spell::EffectDummy(), Spell::EffectEnergize(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectInebriate(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectStuck(), Spell::EffectSummonType(), Spell::EffectTaunt(), Spell::EffectTeleportUnits(), Spell::EffectTitanGrip(), Spell::EffectTriggerMissileSpell(), Spell::EffectTriggerRitualOfSummoning(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EmpowerCultist(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundEY::EventTeamCapturedPoint(), BattleExperienceEvent::Execute(), OrcDeathEvent::Execute(), CastArmageddon::Execute(), UtherBatteredHiltEvent::Execute(), ShockVortexExplodeEvent::Execute(), ResetEncounterEvent::Execute(), FrostBombExplosion::Execute(), IceTombSummonEvent::Execute(), VileSpiritActivateEvent::Execute(), LichKingMovieEvent::Execute(), DelayedCastEvent::Execute(), DelayedCastMincharEvent::Execute(), ChargeRifts::Execute(), CosmicSmashDamageEvent::Execute(), CastRunesEvent::Execute(), BoomEvent::Execute(), SACActivateEvent::Execute(), VerasEnvenom::Execute(), CastQuill::Execute(), lapseTeleport::Execute(), boss_kaelthas::ExecuteMiddleEvent(), boss_salramm::boss_salrammAI::ExplodeGhoul(), spell_festergut_blighted_spores_aura::ExtraEffect(), spell_rotface_mutated_infection_aura::ExtraRemoveEffect(), npc_dark_iron_attack_generator::FinishAttackDueToWin(), npc_azure_saboteur::npc_azure_saboteurAI::FinishPointReached(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), go_soulwell::go_soulwellAI::GossipHello(), spell_cataclysm_breath::HandleAfterCast(), spell_dk_chains_of_ice::HandleAfterCast(), spell_mage_arcane_blast::HandleAfterCast(), spell_q13086_last_line_of_defence::HandleAfterCast(), spell_infected_worgen_bite_aura::HandleAfterEffectApply(), spell_dk_blood_boil::HandleAfterHit(), spell_dk_scourge_strike::HandleAfterHit(), spell_rog_deadly_poison::HandleAfterHit(), spell_warlords_rage::HandleAfterRemove(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_felmyst_fog_of_corruption_charm_aura::HandleApply(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), spell_dru_enrage::HandleApply(), spell_rog_killing_spree_aura::HandleApply(), spell_warr_vigilance::HandleApply(), spell_azjol_nerub_pound::HandleApplyAura(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraProc(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_dk_death_grip::HandleBaseDummy(), misc_commandscript::HandleBindSightCommand(), spell_rotface_unstable_ooze_explosion_init::HandleCast(), spell_commander_sarannis_summon_reinforcements::HandleCast(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastDistCommand(), cast_commandscript::HandleCastSelfCommand(), cast_commandscript::HandleCastTargetCommad(), spell_gen_mounted_charge::HandleChargeEffect(), spell_dk_corpse_explosion::HandleCorpseExplosion(), OutdoorPvPSI::HandleCustomSpell(), WorldSession::HandleDuelCancelledOpcode(), spell_icc_shattered_bones::HandleDummy(), spell_corrupted_totems::HandleDummy(), spell_moroes_vanish::HandleDummy(), spell_karazhan_blink::HandleDummy(), spell_ooze_zap::HandleDummy(), spell_saviana_conflagration_init::HandleDummy(), spell_igb_burning_pitch_selector::HandleDummy(), spell_igb_burning_pitch::HandleDummy(), spell_charge_shield_bomber::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_anti_air_rocket_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_illidan_found_target::HandleDummy(), spell_leotheras_chaos_blast::HandleDummy(), spell_morogrim_tidewalker_watery_grave::HandleDummy(), spell_q10935_the_exorcism_of_colonel_jules::HandleDummy(), spell_gen_focused_bursts::HandleDummy(), spell_shadowblink::HandleDummy(), spell_spawn_drakonid::HandleDummy(), spell_send_mug_target_picker::HandleDummy(), spell_hallows_end_candy::HandleDummy(), spell_hallows_end_bucket_lands::HandleDummy(), spell_midsummer_torch_catch::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_mana_burn_area::HandleDummy(), spell_voljin_war_drums::HandleDummy(), spell_voodoo::HandleDummy(), spell_sartharion_lava_strike::HandleDummy(), spell_halion_meteor_strike_targeting::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_drakkari_colossus_emerge::HandleDummy(), spell_drakkari_colossus_surge::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_voa_flaming_cinder::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_vehicle_warhead_fuse::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_najentus_needle_spine::HandleDummy(), spell_ice_spear_target_picker::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_gen_cannibalize::HandleDummy(), spell_gen_gadgetzan_transporter_backfire::HandleDummy(), spell_gen_gnomish_transporter::HandleDummy(), spell_hun_masters_call::HandleDummy(), spell_hun_pet_carrion_feeder::HandleDummy(), spell_item_gnomish_universal_remote::HandleDummy(), spell_item_gnomish_shrink_ray::HandleDummy(), spell_item_trigger_spell::HandleDummy(), spell_item_deviate_fish::HandleDummy(), spell_item_flask_of_the_north::HandleDummy(), spell_item_make_a_wish::HandleDummy(), spell_item_mingos_fortune_generator::HandleDummy(), spell_item_net_o_matic::HandleDummy(), spell_item_noggenfogger_elixir::HandleDummy(), spell_item_savory_deviate_delight::HandleDummy(), spell_item_six_demon_bag::HandleDummy(), spell_item_underbelly_elixir::HandleDummy(), spell_item_vanquished_clutches::HandleDummy(), spell_item_purify_helboar_meat::HandleDummy(), spell_item_reindeer_transformation::HandleDummy(), spell_item_nigh_invulnerability::HandleDummy(), spell_item_poultryizer::HandleDummy(), spell_item_socrethars_stone::HandleDummy(), spell_item_demon_broiled_surprise::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_nitro_boots::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_item_rocket_boots::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_item_greatmothers_soulcatcher::HandleDummy(), spell_mage_summon_water_elemental::HandleDummy(), spell_pal_blessing_of_faith::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pal_judgement_of_command::HandleDummy(), spell_pri_penance::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q5206_test_fetid_skull::HandleDummy(), spell_q11396_11399_scourging_crystal_controller::HandleDummy(), spell_q11587_arcane_prisoner_rescue::HandleDummy(), spell_q11730_ultrasonic_screwdriver::HandleDummy(), spell_q12634_despawn_fruit_tosser::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_q12937_relief_for_the_fallen::HandleDummy(), spell_q9452_cast_net::HandleDummy(), spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy::HandleDummy(), spell_q12308_escape_from_silverbrook::HandleDummy(), spell_q12641_death_comes_from_on_high::HandleDummy(), spell_rog_shiv::HandleDummy(), spell_sha_fire_nova::HandleDummy(), spell_warl_ritual_of_doom_effect::HandleDummy(), spell_warl_soulshatter::HandleDummy(), spell_warr_charge::HandleDummy(), spell_magtheridon_shadow_grasp::HandleDummyApply(), HandleDummyAuraProc(), spell_yogg_saron_destabilization_matrix::HandleDummyEffect(), spell_yogg_saron_insane_periodic_trigger::HandleDummyEffect(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_talon_king_ikiss_blink::HandleDummyHitTarget(), spell_shadowfang_keep_forsaken_skills_aura::HandleDummyTick(), spell_item_rocket_chicken::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_shadowfang_keep_haunting_spirits_aura::HandleDummyTick(), spell_blood_council_shadow_prison_aura::HandleDummyTick(), spell_mark_of_nature::HandleEffect(), spell_target_fissures::HandleEffect(), spell_rog_vanish::HandleEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_lich_king_vo_blocker::HandleEffectApply(), spell_midsummer_ribbon_pole::HandleEffectApply(), spell_tharon_ja_dummy_aura::HandleEffectApply(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_leotheras_insidious_whisper_aura::HandleEffectApply(), spell_serpentshrine_cavern_coilfang_water::HandleEffectApply(), spell_q12851_going_bearback::HandleEffectApply(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_gen_whisper_gulch_yogg_saron_whisper::HandleEffectPeriodic(), spell_rog_killing_spree_aura::HandleEffectPeriodic(), spell_sha_earthbind_totem::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_warr_retaliation::HandleEffectProc(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_trigger_aura::HandleEffectRemove(), spell_teron_gorefiend_shadow_of_death::HandleEffectRemove(), spell_black_temple_skeleton_shot_aura::HandleEffectRemove(), spell_hydross_cleansing_field_command::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite_trigger_aura::HandleEffectRemove(), spell_q10930_big_bone_worm_aura::HandleEffectRemove(), spell_q10929_fumping_aura::HandleEffectRemove(), spell_flamewreath::HandleFinish(), spell_midsummer_fling_torch::HandleFinish(), spell_midsummer_juggling_torch::HandleFinish(), spell_wintergrasp_rp_gg::HandleFinish(), spell_dreamwalker_summoner::HandleForceCast(), spell_dreamwalker_summon_suppresser_effect::HandleForceCast(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), OPvPCapturePointZM_GraveYard::HandleGossipOption(), spell_item_crazy_alchemists_potion::HandleHeal(), spell_magtheridon_quake::HandleHit(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundIC::HandleKillUnit(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_ticking_time_bomb_aura::HandleOnEffectRemove(), spell_delusions_of_jindo::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), spell_mark_of_frost_freeze::HandleOnHit(), spell_mutate_explode_bug::HandleOnHit(), spell_explode_trigger::HandleOnHit(), spell_blade_dance_targeting::HandleOnHit(), HandleOverrideClassScriptAuraProc(), aura_class_call_wild_magic::HandlePeriodic(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_halion_meteor_strike_spread_aura::HandlePeriodic(), spell_sladran_grip_of_sladran_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_close_rift_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_rancid_spore_cloud::HandlePeriodic(), spell_kaelthas_remote_toy::HandlePeriodic(), spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic(), spell_sha_totemic_mastery::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_kiljaeden_shadow_spike_aura::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), spell_halion_twilight_cutter_periodic_aura::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), spell_voa_overcharge_aura::HandlePeriodicDummy(), AuraEffect::HandlePeriodicDummyAuraTick(), spell_magtheridon_shadow_grasp::HandlePeriodicRemove(), spell_igb_periodic_trigger_with_power_cost_aura::HandlePeriodicTick(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceMoveByAI(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), WorldState::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), BattlegroundIC::HandlePlayerResurrect(), misc_commandscript::HandlePossessCommand(), spell_blood_queen_vampiric_bite::HandlePresence(), spell_mark_of_malice::HandleProc(), spell_item_lil_phylactery::HandleProc(), spell_item_fate_rune_of_unsurpassed_vigor::HandleProc(), spell_mage_burning_determination::HandleProc(), spell_rog_tricks_of_the_trade::HandleProc(), spell_gyth_chromatic_protection::HandleProc(), spell_ahune_spanky_hands::HandleProc(), spell_item_trauma::HandleProc(), spell_item_shadows_fate::HandleProc(), spell_utgarde_pinnacle_beast_mark::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_hun_improved_mend_pet::HandleProc(), spell_hun_misdirection::HandleProc(), spell_item_aegis_of_preservation::HandleProc(), spell_item_desperate_defense::HandleProc(), spell_mage_focus_magic::HandleProc(), spell_pal_blessing_of_sanctuary::HandleProc(), spell_pri_item_greater_heal_refund::HandleProc(), spell_pri_mana_leech::HandleProc(), spell_sha_item_lightning_shield_trigger::HandleProc(), spell_warr_vigilance::HandleProc(), spell_karazhan_temptation::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_dk_dancing_rune_weapon::HandleProc(), spell_gen_moss_covered_feet::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_item_shadowmourne::HandleProc(), spell_sha_item_lightning_shield::HandleProc(), spell_warl_glyph_of_shadowflame::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_hun_lock_and_load::HandleProcs(), HandleProcTriggerSpell(), AuraEffect::HandleProcTriggerSpellAuraProc(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), AuraEffect::HandleRaidProcFromChargeAuraProc(), spell_dk_raise_dead::HandleRaiseDead(), spell_vael_burning_adrenaline::HandleRemove(), spell_kiljaeden_darkness_aura::HandleRemove(), spell_entropius_void_zone_visual_aura::HandleRemove(), spell_igb_rocket_pack_aura::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_gen_mine_sweeper::HandleSchoolDMG(), spell_warl_shadowflame::HandleSchoolDMG(), spell_gen_bandage::HandleScript(), spell_pal_lay_on_hands::HandleScript(), spell_kormok_summon_bone_mages::HandleScript(), spell_kormok_summon_bone_minions::HandleScript(), spell_energize_aoe::HandleScript(), spell_saviana_conflagration_throwback::HandleScript(), spell_taldaram_glittering_sparks::HandleScript(), spell_blood_queen_bloodbolt::HandleScript(), spell_blood_queen_presence_of_the_darkfallen::HandleScript(), spell_igb_rocket_artillery::HandleScript(), spell_putricide_unstable_experiment::HandleScript(), spell_sindragosa_icy_grip::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_summon_spirit_bomb::HandleScript(), spell_dreamwalker_summon_portal::HandleScript(), spell_dreamwalker_twisted_nightmares::HandleScript(), spell_archavon_rock_shards::HandleScript(), spell_wintergrasp_portal::HandleScript(), spell_gen_create_lance::HandleScript(), spell_item_defibrillate::HandleScript(), spell_item_scroll_of_recall::HandleScript(), spell_shazzrah_gate_dummy::HandleScript(), spell_apothecary_lingering_fumes::HandleScript(), spell_apothecary_validate_area::HandleScript(), spell_apothecary_throw_cologne::HandleScript(), spell_apothecary_throw_perfume::HandleScript(), spell_hallows_end_trick::HandleScript(), spell_hallows_end_put_costume::HandleScript(), spell_hallows_end_trick_or_treat::HandleScript(), spell_winter_veil_mistletoe::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_moam_summon_mana_fiends::HandleScript(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), spell_mistress_kiss_area::HandleScript(), spell_novos_summon_minions::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_choking_gas_bomb::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_the_lich_king_cast_back_to_caster::HandleScript(), spell_frost_giant_death_plague::HandleScript(), spell_yogg_saron_target_selectors::HandleScript(), spell_the_black_stalker_levitate::HandleScript(), spell_the_black_stalker_levitation_pulse::HandleScript(), spell_the_black_stalker_someone_grab_me::HandleScript(), spell_the_black_stalker_magnetic_pull::HandleScript(), spell_the_flag_of_ownership::HandleScript(), spell_gen_elune_candle::HandleScript(), spell_gen_teleporting::HandleScript(), spell_gen_dalaran_disguise::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), spell_item_eggnog::HandleScript(), spell_q12735_song_of_cleansing::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_q12619_emblazon_runeblade_effect::HandleScript(), spell_q12919_gymers_grab::HandleScript(), spell_q12919_gymers_throw::HandleScript(), spell_q12641_death_comes_from_on_high_summon_ghouls::HandleScriptEffect(), spell_kalecgos_spectral_realm_dummy::HandleScriptEffect(), spell_marrowgar_coldflame_bonestorm::HandleScriptEffect(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_black_temple_bloodbolt::HandleScriptEffect(), spell_lady_vashj_summon_sporebat::HandleScriptEffect(), spell_kaelthas_summon_weapons::HandleScriptEffect(), spell_kaelthas_gravity_lapse::HandleScriptEffect(), spell_kaelthas_nether_beam::HandleScriptEffect(), spell_gen_clone::HandleScriptEffect(), spell_gen_clone_weapon::HandleScriptEffect(), spell_gen_break_shield::HandleScriptEffect(), spell_gen_mounted_charge::HandleScriptEffect(), spell_gen_throw_shield::HandleScriptEffect(), spell_item_sleepy_willy::HandleScriptEffect(), spell_item_lil_xt::HandleScriptEffect(), spell_q12698_the_gift_that_keeps_on_giving::HandleScriptEffect(), spell_death_knight_initiate_visual::HandleScriptEffect(), spell_q12779_an_end_to_all_things::HandleScriptEffect(), spell_brewfest_toss_mug::HandleScriptEffect(), spell_direbrew_summon_mole_machine_target_picker::HandleScriptEffect(), spell_request_second_mug::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), spell_dtk_summon_random_drakkari::HandleScriptEffect(), spell_marrowgar_coldflame::HandleScriptEffect(), spell_arcane_chains_character_force_cast::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), spell_black_temple_summon_shadowfiends::HandleScriptEffect(), spell_ice_bombardment_dest_picker::HandleScriptEffect(), spell_kaelthas_remove_enchanted_weapons::HandleScriptEffect(), spell_kaelthas_kael_explodes::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_hun_masters_call::HandleScriptEffect(), spell_item_mirrens_drinking_hat::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), spell_q1846_bending_shinbone::HandleScriptEffect(), spell_q14112_14145_chum_the_water::HandleScriptEffect(), WorldSession::HandleSelfResOpcode(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleSpellClick(), spell_marrowgar_bone_spike_graveyard::HandleSpikes(), AuraEffect::HandleSpiritOfRedemption(), spell_gen_paralytic_poison::HandleStun(), spell_putricide_mutated_transformation::HandleSummon(), spell_item_draenic_pale_ale::HandleSummon(), WorldSession::HandleTalentWipeConfirmOpcode(), spell_mother_shahraz_fatal_attraction::HandleTeleportUnits(), spell_warl_drain_soul::HandleTick(), WorldSession::HandleTrainerBuySpellOpcode(), spell_trigger_spell_from_caster::HandleTrigger(), spell_magic_eater_food::HandleTriggerSpell(), spell_winter_veil_racer_rocket_slam::HandleTriggerSpell(), spell_pal_righteous_defense::HandleTriggerSpellHit(), boss_onyxia::HandleWhelpSpam(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_ichoron::boss_ichoronAI::IchoronDoCastToAllHostilePlayers(), spell_q10769_dissension_amongst_the_ranks_aura::if(), CharmInfo::InitCharmCreateSpells(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InitFight(), boss_urok_doomhowl::boss_urok_doomhowlAI::InitializeAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::InitializeAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::InitializeAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::InitializeAI(), boss_gal_darah::boss_gal_darahAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), CharmInfo::InitPossessCreateSpells(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_faction_championsAI::IsCCed(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), TriggerAI::IsSummonedBy(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_pet_gen_fetch_ball::IsSummonedBy(), npc_hallows_end_soh::JustDied(), boss_rajaxx::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), npc_swarm_scarab::npc_swarm_scarabAI::JustDied(), npc_phantom_hallucination::npc_phantom_hallucinationAI::JustDied(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustDied(), boss_steelbreaker::boss_steelbreakerAI::JustDied(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustDied(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustDied(), boss_freya_summons::boss_freya_summonsAI::JustDied(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::JustDied(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::JustDied(), boss_skarvald_the_constructor::JustDied(), boss_dalronn_the_controller::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), boss_fathomguard_sharkkis::JustDied(), boss_fathomguard_tidalvess::JustDied(), boss_fathomguard_caribdis::JustDied(), CombatAI::JustDied(), npc_high_inquisitor_valroth::npc_high_inquisitor_valrothAI::JustDied(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_sapphiron::boss_sapphironAI::JustDied(), boss_anomalus::JustDied(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), boss_shade_of_akama::JustDied(), CasterAI::JustEngagedWith(), boss_servant_quarters::JustEngagedWith(), npc_mograine::npc_mograineAI::JustEngagedWith(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustEngagedWith(), boss_akilzon::JustEngagedWith(), npc_hallows_end_soh::JustEngagedWith(), boss_eadric::boss_eadricAI::JustEngagedWith(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustEngagedWith(), boss_twin_valkyrAI::JustEngagedWith(), boss_garfrost::boss_garfrostAI::JustEngagedWith(), npc_stinky_icc::npc_stinky_iccAI::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), npc_rimefang::npc_rimefangAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), boss_freya_summons::boss_freya_summonsAI::JustEngagedWith(), boss_vezax::boss_vezaxAI::JustEngagedWith(), boss_hodir::boss_hodirAI::JustEngagedWith(), boss_thorim::boss_thorimAI::JustEngagedWith(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::JustEngagedWith(), boss_koralon::boss_koralonAI::JustEngagedWith(), boss_toravon::boss_toravonAI::JustEngagedWith(), boss_ichoron::boss_ichoronAI::JustEngagedWith(), boss_moragg::boss_moraggAI::JustEngagedWith(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_watchkeeper_gargolmar::JustEngagedWith(), boss_gatewatcher_gyrokill::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), boss_sartharion::boss_sartharionAI::JustEngagedWith(), CombatAI::JustEngagedWith(), boss_yauj::JustEngagedWith(), boss_novos::boss_novosAI::JustEngagedWith(), boss_moorabi::boss_moorabiAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_sapphiron::boss_sapphironAI::JustEngagedWith(), boss_keristrasza::JustEngagedWith(), boss_steelbreaker::boss_steelbreakerAI::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_fathomlord_karathress::JustEngagedWith(), boss_fathomguard_sharkkis::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustReachedHome(), boss_bronjahm::boss_bronjahmAI::JustReachedHome(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustReachedHome(), boss_gal_darah::boss_gal_darahAI::JustReachedHome(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::JustReachedHome(), boss_freya::boss_freyaAI::JustSummoned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_skeram::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_ragnaros::boss_ragnarosAI::JustSummoned(), boss_vexallus::JustSummoned(), boss_kiljaeden::JustSummoned(), npc_kalecgos_kj::JustSummoned(), boss_jindo::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_taldaram::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_gal_darah::boss_gal_darahAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::JustSummoned(), boss_malygos::boss_malygosAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_svala::boss_svalaAI::JustSummoned(), boss_shirrak_the_dead_watcher::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), boss_grandmaster_vorpil::JustSummoned(), boss_gurtogg_bloodboil::JustSummoned(), boss_veras_darkshadow::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_supremus::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::JustSummoned(), boss_ayamiss::JustSummoned(), Kill(), boss_azuregos::boss_azuregosAI::KilledUnit(), boss_anubrekhan::boss_anubrekhanAI::KilledUnit(), boss_doomwalker::KilledUnit(), npc_dark_iron_guzzler::KilledUnit(), boss_steelbreaker::boss_steelbreakerAI::KilledUnit(), emerald_dragonAI::KilledUnit(), boss_emeriss::boss_emerissAI::KilledUnit(), boss_felblood_kaelthas::LapseAction(), spell_mandokir_charge::LaunchHit(), Player::learnQuestRewardedSpells(), spell_taldaram_summon_flame_ball::Load(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), boss_temporus::MoveInLineOfSight(), npc_medivh_bm::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), npc_unworthy_initiate::npc_unworthy_initiateAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_eck::boss_eckAI::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), boss_malygos::boss_malygosAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::MovementInform(), boss_headless_horseman::MovementInform(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::MovementInform(), npc_ashtongue_sorcerer::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), boss_kagani_nightstrike::MovementInform(), npc_dark_iron_guzzler::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::npc_assembly_lightningAI::MovementInform(), boss_ymiron::boss_ymironAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), BattlegroundAB::NodeOccupied(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::npc_algalon_worm_holeAI(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_frost_tomb::npc_frost_tomb(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_hol_monument::npc_hol_monumentAI::npc_hol_monumentAI(), npc_midsummer_torch_target::npc_midsummer_torch_target(), npc_power_spark::npc_power_sparkAI::npc_power_sparkAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::npc_ulduar_iron_constructAI(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fireAI::npc_ulduar_toasty_fireAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), spell_shadowfang_keep_forsaken_skills_aura::OnApply(), spell_direbrew_disarm::OnApply(), spell_love_is_in_the_air_romantic_picnic::OnApply(), spell_halion_combustion_consumption_aura::OnApply(), spell_load_into_catapult_aura::OnApply(), spell_gen_damage_reduction_aura::OnApply(), spell_gruul_ground_slam_trigger::OnApply(), spell_hun_ascpect_of_the_viper::OnApply(), spell_hun_viper_attack_speed::OnApply(), spell_item_with_mount_speed::OnApply(), spell_blood_queen_vampiric_bite::OnCast(), npc_chesspiece::OnCharmed(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_item_linken_boomerang::OnEffectLaunchTargetDisarm(), spell_item_linken_boomerang::OnEffectLaunchTargetStun(), npc_essence_of_twin::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), go_inconspicuous_mine_car::OnGossipHello(), go_manticron_cube::OnGossipHello(), go_noblegarden_colored_egg::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_orb_of_domination::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_strange_pool::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_steward_of_time::OnGossipSelect(), npc_iruk::OnGossipSelect(), npc_zephyr::OnGossipSelect(), npc_taxi::OnGossipSelect(), npc_locksmith::OnGossipSelect(), npc_engineering_tele_trinket::OnGossipSelect(), npc_sayge::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_lokhtos_darkbargainer::OnGossipSelect(), boss_gloomrel::OnGossipSelect(), npc_death_knight_initiate::OnGossipSelect(), npc_parqual_fintallas::OnGossipSelect(), npcs_riverbreeze_and_silversky::OnGossipSelect(), npc_braug_dimspirit::OnGossipSelect(), npc_avatar_of_freya::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_wormhole::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), go_fel_crystalforge::OnGossipSelect(), go_bashir_crystalforge::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), Player::OnGossipSelect(), lfg::LFGPlayerScript::OnMapChanged(), spell_apothecary_perfume_spill::OnPeriodic(), spell_apothecary_cologne_spill::OnPeriodic(), spell_muru_summon_blood_elves_periodic_aura::OnPeriodic(), spell_claw_rage_aura::OnPeriodic(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_anubisath_mortal_strike::OnPeriodic(), spell_the_lich_king_soul_reaper_aura::OnPeriodic(), spell_yogg_saron_brain_link_aura::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), spell_illidan_tear_of_azzinoth_summon_channel_aura::OnPeriodic(), spell_illidan_demon_transform1_aura::OnPeriodic(), spell_illidan_cage_trap_stun_aura::OnPeriodic(), spell_black_temple_dementia_aura::OnPeriodic(), spell_npc22275_crystal_prison_aura::OnPeriodic(), spell_item_eye_of_grillok_aura::OnPeriodic(), spell_muru_darkness_aura::OnPeriodic(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_the_lich_king_vile_spirits_aura::OnPeriodic(), spell_web_wrap_damage::OnPeriodic(), spell_assembly_rune_of_summoning_aura::OnPeriodic(), spell_thorim_lightning_pillar_P2_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), spell_karathress_power_of_tidalvess::OnPeriodic(), spell_karathress_power_of_caribdis::OnPeriodic(), spell_leotheras_demon_link::OnPeriodic(), spell_lurker_below_spout::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_gen_turkey_marker::OnPeriodic(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnPlayerInWaterStateUpdate(), BattlefieldWG::OnPlayerJoinWar(), npc_steward_of_time::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_rocknot::OnQuestReward(), npc_thrall_bfu::OnQuestReward(), spell_kalecgos_spectral_realm_aura::OnRemove(), spell_azgalor_doom_aura::OnRemove(), spell_boss_salramm_steal_flesh_aura::OnRemove(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_putricide_mutation_init_aura::OnRemove(), spell_the_lich_king_shadow_trap_visual_aura::OnRemove(), spell_the_lich_king_harvest_soul_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_ioc_repair_turret_aura::OnRemove(), spell_kaelthas_flame_strike::OnRemove(), spell_item_goblin_weather_machine_aura::OnRemove(), spell_warl_curse_of_doom::OnRemove(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), spell_item_shadowmourne_soul_fragment::OnStackChange(), at_hor_battered_hilt_throw::OnTrigger(), at_frozen_throne_teleport::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), MidsummerPlayerScript::OnUpdateZone(), npc_wintergarde_gryphon::PassengerBoarded(), npc_four_car_garage::npc_four_car_garageAI::PassengerBoarded(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), spell_quest_test_flight_charging::PerformKick(), spell_send_mug_control_aura::PeriodicTick(), spell_barreled_control_aura::PeriodicTick(), spell_dreamwalker_summon_suppresser_aura::PeriodicTick(), spell_summon_ice_spear_delayer::PeriodicTick(), spell_summoning_rhyme_aura::PeriodicTick(), spell_halion_twilight_phasing::Phase(), Battlefield::PlayerAskToLeave(), BattlegroundAV::PopulateNode(), spell_azjol_nerub_carrion_beetels::PrepareAuraScript(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11653_youre_not_so_big_now::PrepareSpellScript(), spell_q13369_fate_up_against_your_will::PrepareSpellScript(), SmartScript::ProcessAction(), ProcessCastaction(), Player::ProcessDelayedOperations(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), ProcessTerrainStatusUpdate(), ProcessUnlearnAction(), BattlefieldWG::PromotePlayer(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), spell_gen_defend::RefreshVisualShields(), Vehicle::RemovePassenger(), spell_igb_below_zero::RemovePassengers(), boss_keristrasza::RemovePrison(), Player::ReportedAfkBy(), GuardAI::Reset(), npc_demonic_vapor::Reset(), npc_demonic_vapor_trail::Reset(), npc_batrider::Reset(), npc_dark_iron_guzzler::Reset(), boss_headless_horseman_pumpkin::Reset(), npc_taretha::npc_tarethaAI::Reset(), npc_medivh_bm::Reset(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_nerubian_burrower::npc_nerubian_burrowerAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_elemental::boss_drakkari_elementalAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_anomalus::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_bjarngrim::boss_bjarngrimAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_freya_lifebinder::boss_freya_lifebinderAI::Reset(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::Reset(), boss_freya_nature_bomb::boss_freya_nature_bombAI::Reset(), boss_thorim_lightning_orb::boss_thorim_lightning_orbAI::Reset(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::Reset(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::Reset(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_yoggsaron_voice::boss_yoggsaron_voiceAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_frozen_orb::npc_frozen_orbAI::Reset(), npc_frozen_orb_stalker::npc_frozen_orb_stalkerAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::Reset(), npc_storm_cloud::npc_storm_cloudAI::Reset(), npc_ashtongue_channeler::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), boss_wrath_scryer_soccothrates::Reset(), npc_training_dummy::npc_training_dummyAI::Reset(), BfGraveyard::Resurrect(), Resurrect(), Player::ResurrectPlayer(), Player::RewardQuest(), boss_bjarngrim::boss_bjarngrimAI::RollStance(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), Map::ScriptsProcess(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), npc_sayge::SendAction(), go_skull_pile::SendActionMenu(), npc_xt002_heart::npc_xt002_heartAI::SendEnergyToCorner(), Player::SendInitialPacketsAfterAddToMap(), Player::SendQuestUpdate(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), npc_eastvale_peasent::SetData(), SetModelVisible(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_brewfest_keg_reciver::sGossipSelect(), npc_cairne_bloodhoof::npc_cairne_bloodhoofAI::sGossipSelect(), npc_chesspiece::sGossipSelect(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), boss_hodir::boss_hodirAI::SmallIcicles(), boss_skadi_grauf::boss_skadi_graufAI::SpawnFlameTriggers(), boss_malchezaar::SpawnInfernal(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), boss_eadric::boss_eadricAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_ichor_globule::npc_ichor_globuleAI::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_franklin::npc_franklinAI::SpellHit(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_headless_horseman::SpellHit(), boss_thorim_pillar::boss_thorim_pillarAI::SpellHit(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_living_constellation::npc_living_constellationAI::SpellHit(), boss_ignis::boss_ignisAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_storm_cloud::npc_storm_cloudAI::SpellHit(), npc_soh_fire_trigger::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_midsummer_torch_target::SpellHit(), boss_magus_telestra::SpellHit(), boss_thorim::boss_thorimAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_bronjahm::boss_bronjahmAI::SpellHitTarget(), npc_demonic_vapor_trail::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_rotface::boss_rotfaceAI::SpellHitTarget(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), boss_hodir::boss_hodirAI::SpellHitTarget(), npc_ulduar_rocket_strike_trigger::npc_ulduar_rocket_strike_triggerAI::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), boss_epoch::boss_epochAI::SpellHitTarget(), boss_sapphiron::boss_sapphironAI::SpellHitTarget(), boss_skadi_grauf::boss_skadi_graufAI::SpellHitTarget(), boss_shirrak_the_dead_watcher::SpellHitTarget(), npc_pet_gen_soul_trader_beacon::SpellHitTarget(), Battleground::SpiritOfCompetitionEvent(), boss_ionar::boss_ionarAI::Split(), boss_heigan::boss_heiganAI::StartFightPhase(), boss_felmyst::StartIntro(), npc_finklestein::npc_finklesteinAI::StartNextTask(), Player::StoreItem(), spell_dk_ghoul_explode::Suicide(), boss_anzu::SummonBroods(), boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDies(), boss_cthun::SummonedCreatureDies(), boss_vexallus::SummonedCreatureDies(), boss_paletress::boss_paletressAI::SummonMemory(), go_wind_stone::go_wind_stoneAI::SummonNPC(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), spell_igb_check_for_players::TeleportPlayer(), BattlegroundSA::TeleportToEntrancePosition(), spell_midsummer_fling_torch::ThrowNextTorch(), TriggerBurningPitch(), npc_orb_carrier::npc_orb_carrierAI::TriggerCutter(), spell_koralon_meteor_fists_aura::TriggerFists(), spell_flame_warder_meteor_fists_aura::TriggerFists(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_karazhan_brittle_bones_aura::Update(), spell_black_temple_curse_of_the_bleakheart_aura::Update(), spell_illidari_council_deadly_strike_aura::Update(), spell_mother_shahraz_random_periodic_aura::Update(), spell_mother_shahraz_beam_periodic_aura::Update(), spell_mother_shahraz_saber_lash_aura::Update(), spell_black_temple_charge_rage_aura::Update(), Pet::Update(), GameObject::Update(), TotemAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_image_of_medivh::npc_image_of_medivhAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_demonic_vapor_trail::UpdateAI(), npc_kalecgos_kj::UpdateAI(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), npc_hallows_end_train_fire::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_headless_horseman_head::UpdateAI(), boss_headless_horseman_pumpkin::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), npc_time_rift::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_tharnarian::npc_tharnarianAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), npc_halion_controller::npc_halion_controllerAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_swarm_scarab::npc_swarm_scarabAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), npc_pos_icicle_trigger::npc_pos_icicle_triggerAI::UpdateAI(), npc_pos_collapsing_icicle::npc_pos_collapsing_icicleAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(), boss_heigan::boss_heiganAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_naxxramas_misc::boss_naxxramas_miscAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), npc_alexstrasza::npc_alexstraszaAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), npc_crystal_spike::UpdateAI(), npc_crystalline_frayer::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir::boss_sjonnirAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::UpdateAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_ulduar_icicle::npc_ulduar_icicleAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_kologarn_eyebeam::boss_kologarn_eyebeamAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), npc_ulduar_proximity_mine::npc_ulduar_proximity_mineAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_watcher::npc_ulduar_dark_rune_watcherAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_thorim_trap::boss_thorim_trapAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_xt002_pummeller::npc_xt002_pummellerAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_dalronn_the_controller::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_thassarian::npc_thassarianAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_jungle_punch_target::npc_jungle_punch_targetAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_queue::npc_wg_queueAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_lady_malande::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_invis_infernal_caster::npc_invis_infernal_casterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), trigger_periodic::trigger_periodicAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_maexxna_webwrap::boss_maexxna_webwrapAI::UpdateAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI(), npc_q24545_vegard_dummy::npc_q24545_vegard_dummyAI::UpdateAI(), Player::UpdateAreaDependentAuras(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdatePhase(), Player::UpdateZoneDependentAuras(), GameObject::Use(), Player::VehicleSpellInitialize(), boss_bjarngrim::boss_bjarngrimAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_engineer_helice::npc_engineer_heliceAI::WaypointReached().

◆ CastSpell() [4/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1213{
1214 return CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1215}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [5/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1218{
1219 SpellCastTargets targets;
1220 targets.SetUnitTarget(victim);
1221 return CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
1222}

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastSpell() [6/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1196{
1197 return CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1198}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [7/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1201{
1202 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1203 if (!spellInfo)
1204 {
1205 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1207 }
1208
1209 return CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
1210}

References CastSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastStop()

◆ ChangeSeat()

void Unit::ChangeSeat ( int8  seatId,
bool  next = true 
)
19740{
19741 if (!m_vehicle)
19742 return;
19743
19744 if (seatId < 0)
19745 {
19746 seatId = m_vehicle->GetNextEmptySeat(GetTransSeat(), next);
19747 if (seatId < 0)
19748 return;
19749 }
19750 else if (seatId == GetTransSeat() || !m_vehicle->HasEmptySeat(seatId))
19751 return;
19752
19754 if (!m_vehicle->AddPassenger(this, seatId))
19755 ABORT();
19756}
int8 GetNextEmptySeat(int8 seatId, bool next) const
Definition Vehicle.cpp:245
bool HasEmptySeat(int8 seatId) const
Definition Vehicle.cpp:219

References ABORT, Vehicle::AddPassenger(), Vehicle::GetNextEmptySeat(), WorldObject::GetTransSeat(), Vehicle::HasEmptySeat(), m_vehicle, and Vehicle::RemovePassenger().

Referenced by _EnterVehicle(), and WorldSession::HandleChangeSeatsOnControlledVehicle().

◆ CleanupBeforeRemoveFromMap()

void Unit::CleanupBeforeRemoveFromMap ( bool  finalCleanup)
15766{
15768 return;
15769
15770 // This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
15772
15773 if (IsInWorld()) // not in world and not being removed atm
15775
15776 ASSERT(GetGUID());
15777
15778 // A unit may be in removelist and not in world, but it is still in grid
15779 // and may have some references during delete
15782
15783 if (finalCleanup)
15784 m_cleanupDone = true;
15785
15786 CombatStop();
15791 GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
15792}
void deleteReferences(bool removeFromMap=false)
Definition HostileRefMgr.cpp:125
void Clear(bool reset=true)
Definition MotionMaster.h:167
void ClearAllThreat()
Definition ThreatMgr.cpp:417
void CombatStop(bool includingCast=false)
Definition Unit.cpp:10459
void RemoveAllGameObjects()
Definition Unit.cpp:6286
void ClearComboPoints()
Definition Unit.cpp:16887
void ClearComboPointHolders()
Definition Unit.cpp:16942
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:913
void RemoveFromWorld() override
Definition Unit.cpp:15719
void RemoveAllAuras()
Definition Unit.cpp:5319
ThreatMgr & GetThreatMgr()
Definition Unit.h:909

References ASSERT, MotionMaster::Clear(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearComboPoints(), CombatStop(), HostileRefMgr::deleteReferences(), Object::GetGUID(), getHostileRefMgr(), GetMotionMaster(), GetThreatMgr(), InterruptNonMeleeSpells(), IsDuringRemoveFromWorld(), Object::IsInWorld(), m_cleanupDone, RemoveAllAuras(), RemoveAllGameObjects(), and RemoveFromWorld().

Referenced by CleanupsBeforeDelete().

◆ CleanupsBeforeDelete()

void Unit::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

15795{
15796 if (GetTransport())
15797 {
15799 SetTransport(nullptr);
15802 }
15803
15804 CleanupBeforeRemoveFromMap(finalCleanup);
15805}
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
void CleanupBeforeRemoveFromMap(bool finalCleanup)
Definition Unit.cpp:15765
void SetTransport(Transport *t)
Definition Object.h:605
void Reset()
Definition Object.h:292
void RemoveMovementFlag(uint32 flag)
Definition Object.h:338

References CleanupBeforeRemoveFromMap(), WorldObject::GetTransport(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), and MovementInfo::transport.

Referenced by Player::CleanupsBeforeDelete(), npc_commandscript::HandleNpcAddCommand(), and Map::RemoveAllObjectsInRemoveList().

◆ ClearAllReactives()

void Unit::ClearAllReactives ( )
16951{
16952 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
16953 m_reactiveTimer[i] = 0;
16954
16961}
@ CLASS_HUNTER
Definition SharedDefines.h:143
@ CLASS_WARRIOR
Definition SharedDefines.h:141
@ AURA_STATE_DEFENSE
Definition SharedDefines.h:1292
@ AURA_STATE_HUNTER_PARRY
Definition SharedDefines.h:1298
@ CLASS_CONTEXT_ABILITY_REACTIVE
Definition UnitDefines.h:235
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition Unit.h:807
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition Unit.cpp:10570

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), Object::IsPlayer(), m_reactiveTimer, MAX_REACTIVE, and ModifyAuraState().

Referenced by Player::ActivateSpec(), npc_mograine::npc_mograineAI::DamageTaken(), and setDeathState().

◆ ClearComboPointHolders()

void Unit::ClearComboPointHolders ( )
16943{
16944 while (!m_ComboPointHolders.empty())
16945 {
16946 (*m_ComboPointHolders.begin())->ClearComboPoints(); // this also removes it from m_comboPointHolders
16947 }
16948}

References ClearComboPoints(), and m_ComboPointHolders.

Referenced by CreatureAI::_EnterEvadeMode(), CleanupBeforeRemoveFromMap(), npc_mograine::npc_mograineAI::DamageTaken(), Player::RemoveFromWorld(), and setDeathState().

◆ ClearComboPoints()

void Unit::ClearComboPoints ( )
16888{
16889 if (!m_comboTarget)
16890 {
16891 return;
16892 }
16893
16894 // remove Premed-like effects
16895 // (NB: this Aura retains the CP while it's active - now that CP have reset, it shouldn't be there anymore)
16897
16898 m_comboPoints = 0;
16901 m_comboTarget = nullptr;
16902}
@ SPELL_AURA_RETAIN_COMBO_POINTS
Definition SpellAuraDefines.h:211

References m_comboPoints, m_comboTarget, RemoveAurasByType(), RemoveComboPointHolder(), SendComboPoints(), and SPELL_AURA_RETAIN_COMBO_POINTS.

Referenced by Spell::_handle_finish_phase(), CleanupBeforeRemoveFromMap(), ClearAllReactives(), ClearComboPointHolders(), Player::DuelComplete(), Player::RemoveFromWorld(), Player::setDeathState(), and UpdateReactives().

◆ ClearDiminishings()

void Unit::ClearDiminishings ( )
inline
1773{ m_Diminishing.clear(); }

References m_Diminishing.

Referenced by setDeathState().

◆ ClearInCombat()

void Unit::ClearInCombat ( )
13833{
13834 m_CombatTimer = 0;
13836
13837 // Player's state will be cleared in Player::UpdateContestedPvP
13838 if (Creature* creature = ToCreature())
13839 {
13840 if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
13841 SetImmuneToPC(true); // set immunity state to the one from db on evade
13842
13845 ReplaceAllDynamicFlags(creature->GetCreatureTemplate()->dynamicflags);
13846
13847 creature->SetAssistanceTimer(0);
13848
13849 // Xinef: will be recalculated at follow movement generator initialization
13850 if (!IsPet() && !IsCharmed())
13851 return;
13852 }
13853 else if (Player* player = ToPlayer())
13854 {
13855 player->UpdatePotionCooldown();
13856 if (player->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
13857 for (uint8 i = 0; i < MAX_RUNES; ++i)
13858 player->SetGracePeriod(i, 0);
13859 }
13860
13861 if (Player* player = this->ToPlayer())
13862 {
13863 sScriptMgr->OnPlayerLeaveCombat(player);
13864 }
13865}
#define MAX_RUNES
Definition Player.h:403
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
@ CLASS_CONTEXT_ABILITY
Definition UnitDefines.h:234
@ UNIT_STATE_ATTACK_PLAYER
Definition UnitDefines.h:184
@ UNIT_FLAG_IN_COMBAT
Definition UnitDefines.h:269
@ UNIT_FLAG_IMMUNE_TO_PC
Definition UnitDefines.h:258
void ReplaceAllDynamicFlags(uint32 flag) override
Definition Unit.h:737
bool IsCharmed() const
Definition Unit.h:1241
bool IsPet() const
Definition Unit.h:760
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:13634
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:720

References CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, ClearUnitState(), Object::HasDynamicFlag(), IsCharmed(), IsPet(), m_CombatTimer, MAX_RUNES, RemoveUnitFlag(), ReplaceAllDynamicFlags(), SetImmuneToPC(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_DYNFLAG_TAPPED, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IN_COMBAT, and UNIT_STATE_ATTACK_PLAYER.

Referenced by CombatStop(), Player::LoadFromDB(), and Update().

◆ ClearInPetCombat()

◆ ClearUnitState()

void Unit::ClearUnitState ( uint32  f)
inline
708{ m_state &= ~f; }

References m_state.

Referenced by Spell::_cast(), HomeMovementGenerator< Creature >::_setTargetLocation(), Attack(), FollowerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), AttackStop(), ClearInCombat(), boss_thorim::boss_thorimAI::DisableThorim(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), HomeMovementGenerator< Creature >::DoFinalize(), WaypointMovementGenerator< Creature >::DoFinalize(), RandomMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), RandomMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), Spell::EffectResurrectPet(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_ayamiss::EnterEvadeMode(), SmartAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), TimedFleeingMovementGenerator::Finalize(), RotateMovementGenerator::Finalize(), DistractMovementGenerator::Finalize(), AssistanceDistractMovementGenerator::Finalize(), Spell::finish(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), SmartAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), MotionMaster::MoveTargetedHome(), WaypointMovementGenerator< Creature >::OnArrived(), boss_nightbane::PathEndReached(), Creature::ReleaseFocus(), RemoveCharmedBy(), MotionTransport::RemovePassenger(), boss_ayamiss::Reset(), boss_hungarfen::Reset(), Player::ResetContestedPvP(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SetClientControl(), SetControlled(), Creature::setDeathState(), Player::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Player::SetIsSpectator(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), StopMoving(), StopMovingOnCurrentPos(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), and boss_the_lich_king::boss_the_lich_kingAI::UpdateAI().

◆ CombatStart()

void Unit::CombatStart ( Unit target,
bool  initialAggro = true 
)
13653{
13654 // Xinef: Dont allow to start combat with triggers
13655 if (victim->IsCreature() && victim->ToCreature()->IsTrigger())
13656 return;
13657
13658 if (initialAggro)
13659 {
13660 // Make player victim stand up automatically
13661 if (victim->getStandState() && victim->IsPlayer())
13662 {
13663 victim->SetStandState(UNIT_STAND_STATE_STAND);
13664 }
13665
13666 if (!victim->IsInCombat() && !victim->IsPlayer() && !victim->ToCreature()->HasReactState(REACT_PASSIVE) && victim->ToCreature()->IsAIEnabled)
13667 {
13668 if (victim->IsPet())
13669 victim->ToCreature()->AI()->AttackedBy(this); // PetAI has special handler before AttackStart()
13670 else
13671 {
13672 victim->ToCreature()->AI()->AttackStart(this);
13673 // if the target is an NPC with a pet or minion, pet should react.
13674 if (Unit* victimControlledUnit = victim->GetFirstControlled())
13675 {
13676 victimControlledUnit->SetInCombatWith(this);
13677 SetInCombatWith(victimControlledUnit);
13678 victimControlledUnit->AddThreat(this, 0.0f);
13679 }
13680 }
13681
13682 // if unit has an owner, put owner in combat.
13683 if (Unit* victimOwner = victim->GetOwner())
13684 {
13685 if (!(victimOwner->IsInCombatWith(this)))
13686 {
13687 /* warding off to not take over aggro for no reason
13688 Using only AddThreat causes delay in attack */
13689 if (!victimOwner->IsInCombat() && victimOwner->IsAIEnabled)
13690 {
13691 victimOwner->ToCreature()->AI()->AttackStart(this);
13692 }
13693 victimOwner->SetInCombatWith(this);
13694 SetInCombatWith(victimOwner);
13695 victimOwner->AddThreat(this, 0.0f);
13696 }
13697 }
13698 }
13699
13700 bool alreadyInCombat = IsInCombat();
13701
13702 SetInCombatWith(victim);
13703 victim->SetInCombatWith(this);
13704
13705 // Xinef: If pet started combat - put owner in combat
13706 if (!alreadyInCombat && IsInCombat())
13707 {
13708 if (Unit* owner = GetOwner())
13709 {
13710 owner->SetInCombatWith(victim);
13711 victim->SetInCombatWith(owner);
13712 }
13713 }
13714 }
13715
13716 Unit* who = victim->GetCharmerOrOwnerOrSelf();
13717 if (who->IsPlayer())
13718 SetContestedPvP(who->ToPlayer());
13719
13721 if (player && who->IsPvP() && (!who->IsPlayer() || !player->duel || player->duel->Opponent != who))
13722 {
13723 player->UpdatePvP(true);
13725 }
13726}
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
Definition SpellDefines.h:66
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
@ REACT_PASSIVE
Definition Unit.h:548
void UpdatePvP(bool state, bool _override=false)
Definition PlayerUpdates.cpp:1484
Unit * GetCharmerOrOwnerOrSelf() const
Definition Unit.h:1218
void SetContestedPvP(Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
Definition Unit.cpp:17271
Unit * GetFirstControlled() const
Definition Unit.cpp:11098

References Creature::AI(), CreatureAI::AttackedBy(), UnitAI::AttackStart(), AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetFirstControlled(), GetOwner(), getStandState(), Creature::HasReactState(), IsAIEnabled, Object::IsCreature(), IsInCombat(), IsPet(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), REACT_PASSIVE, RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), SetStandState(), Object::ToCreature(), Object::ToPlayer(), UNIT_STAND_STATE_STAND, and Player::UpdatePvP().

Referenced by AttackerStateUpdate(), Spell::CheckCast(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectTaunt(), and AssistDelayEvent::Execute().

◆ CombatStartOnCast()

void Unit::CombatStartOnCast ( Unit target,
bool  initialAggro = true,
uint32  duration = 0 
)
13729{
13730 // Xinef: Dont allow to start combat with triggers
13731 if (target->IsCreature() && target->ToCreature()->IsTrigger())
13732 return;
13733
13734 if (initialAggro)
13735 {
13736 SetInCombatWith(target, duration);
13737
13738 // Xinef: If pet started combat - put owner in combat
13739 if (Unit* owner = GetOwner())
13740 owner->SetInCombatWith(target, duration);
13741 }
13742
13743 Unit* who = target->GetCharmerOrOwnerOrSelf();
13744 if (who->IsPlayer())
13745 SetContestedPvP(who->ToPlayer());
13746
13748 if (player && who->IsPvP() && (!who->IsPlayer() || !player->duel || player->duel->Opponent != who))
13749 {
13750 player->UpdatePvP(true);
13752 }
13753}
bool IsTrigger() const
Definition Creature.h:75

References AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetOwner(), Object::IsCreature(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), Object::ToCreature(), Object::ToPlayer(), and Player::UpdatePvP().

Referenced by Spell::_cast().

◆ CombatStop()

void Unit::CombatStop ( bool  includingCast = false)
10460{
10461 if (includingCast && IsNonMeleeSpellCast(false))
10463
10464 AttackStop();
10466 if (IsPlayer())
10467 ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
10468 if (Creature* pCreature = ToCreature())
10469 pCreature->ClearLastLeashExtensionTimePtr();
10470 ClearInCombat();
10471
10472 // xinef: just in case
10473 if (IsPetInCombat() && !IsPlayer())
10475}
void SendAttackSwingCancelAttack()
Definition PlayerMisc.cpp:140
bool IsPetInCombat() const
Definition Unit.h:893
void ClearInPetCombat()
Definition Unit.cpp:13867
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition Unit.cpp:10507
void ClearInCombat()
Definition Unit.cpp:13832
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10426

References AttackStop(), ClearInCombat(), ClearInPetCombat(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), IsPetInCombat(), Object::IsPlayer(), RemoveAllAttackers(), Player::SendAttackSwingCancelAttack(), Object::ToCreature(), and Object::ToPlayer().

Referenced by CreatureAI::_EnterEvadeMode(), PetAI::_stopAttack(), Player::ActivateTaxiPathTo(), CleanupBeforeRemoveFromMap(), CombatStopWithPets(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_kalecgos::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_maiev_illidan::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSanctuary(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), TotemAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleCombatStopCommand(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), npc_commandscript::HandleNpcDeleteCommand(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), SmartScript::ProcessAction(), Player::RemovePet(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), setDeathState(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), Player::TeleportTo(), Totem::UnSummon(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ CombatStopWithPets()

void Unit::CombatStopWithPets ( bool  includingCast = false)
10478{
10479 CombatStop(includingCast);
10480
10481 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10482 (*itr)->CombatStop(includingCast);
10483}

References CombatStop(), and m_Controlled.

Referenced by DealDamage(), WorldSession::HandleDuelCancelledOpcode(), Player::SetGameMaster(), Player::SetGMVisible(), and Player::UpdateArea().

◆ CountPctFromCurHealth()

uint32 Unit::CountPctFromCurHealth ( int32  pct) const
inline
1049{ return CalculatePct(GetHealth(), pct); }
uint32 GetHealth() const
Definition Unit.h:1035

References CalculatePct(), and GetHealth().

Referenced by spell_gen_leeching_swarm_aura::HandleEffectPeriodic().

◆ CountPctFromMaxHealth()

uint32 Unit::CountPctFromMaxHealth ( int32  pct) const
inline
1048{ return CalculatePct(GetMaxHealth(), pct); }
uint32 GetMaxHealth() const
Definition Unit.h:1036

References CalculatePct(), and GetMaxHealth().

Referenced by spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_dk_anti_magic_shell_self::CalculateAmount(), spell_dk_vampiric_blood::CalculateAmount(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::EffectHeal(), Spell::EffectHealPct(), Spell::EffectResurrect(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonType(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), spell_dk_death_strike::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_warr_last_stand::HandleDummy(), HandleDummyAuraProc(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), HandleProcTriggerSpell(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), boss_harbinger_skyriss::JustSummoned(), boss_hadronox::boss_hadronoxAI::KilledUnit(), Pet::LoadPetFromDB(), boss_vaelastrasz::boss_vaelAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), and npc_injured_patient::npc_injured_patientAI::UpdateAI().

◆ CreateTamedPetFrom() [1/2]

Pet * Unit::CreateTamedPetFrom ( Creature creatureTarget,
uint32  spell_id = 0 
)
17375{
17376 if (!IsPlayer())
17377 return nullptr;
17378
17379 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
17380
17381 if (!pet->CreateBaseAtCreature(creatureTarget))
17382 {
17383 delete pet;
17384 return nullptr;
17385 }
17386
17387 uint8 level = creatureTarget->GetLevel() + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevel();
17388
17389 if (!InitTamedPet(pet, level, spell_id))
17390 {
17391 delete pet;
17392 return nullptr;
17393 }
17394
17395 return pet;
17396}
@ HUNTER_PET
Definition PetDefines.h:32
bool CreateBaseAtCreature(Creature *creature)
Definition Pet.cpp:938
bool InitTamedPet(Pet *pet, uint8 level, uint32 spell_id)
Definition Unit.cpp:17418

References Pet::CreateBaseAtCreature(), GetLevel(), HUNTER_PET, InitTamedPet(), Object::IsPlayer(), and Object::ToPlayer().

Referenced by Player::CreatePet(), Player::CreatePet(), Spell::EffectCreateTamedPet(), and Spell::EffectTameCreature().

◆ CreateTamedPetFrom() [2/2]

Pet * Unit::CreateTamedPetFrom ( uint32  creatureEntry,
uint32  spell_id = 0 
)
17399{
17400 if (!IsPlayer())
17401 return nullptr;
17402
17403 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
17404 if (!creatureInfo)
17405 return nullptr;
17406
17407 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
17408
17409 if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
17410 {
17411 delete pet;
17412 return nullptr;
17413 }
17414
17415 return pet;
17416}
#define sObjectMgr
Definition ObjectMgr.h:1635
bool CreateBaseAtCreatureInfo(CreatureTemplate const *cinfo, Unit *owner)
Definition Pet.cpp:973
Definition CreatureData.h:186

References Pet::CreateBaseAtCreatureInfo(), GetLevel(), HUNTER_PET, InitTamedPet(), Object::IsPlayer(), sObjectMgr, and Object::ToPlayer().

◆ CreateVehicleKit()

bool Unit::CreateVehicleKit ( uint32  id,
uint32  creatureEntry 
)

Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)

18739{
18740 VehicleEntry const* vehInfo = sVehicleStore.LookupEntry(id);
18741 if (!vehInfo)
18742 return false;
18743
18744 m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry);
18747 return true;
18748}
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
@ UNIT_MASK_VEHICLE
Definition UnitDefines.h:161
@ UPDATEFLAG_VEHICLE
Definition UpdateData.h:46

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, sVehicleStore, UNIT_MASK_VEHICLE, and UPDATEFLAG_VEHICLE.

Referenced by Creature::CreateFromProto(), AuraEffect::HandleAuraSetVehicle(), Mount(), and npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit().

◆ DealDamage()

uint32 Unit::DealDamage ( Unit attacker,
Unit victim,
uint32  damage,
CleanDamage const *  cleanDamage = nullptr,
DamageEffectType  damagetype = DIRECT_DAMAGE,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  spellProto = nullptr,
bool  durabilityLoss = true,
bool  allowGM = false,
Spell const *  spell = nullptr 
)
static

@fix: Hack to avoid premature leashing

811{
812 // Xinef: initialize damage done for rage calculations
813 // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
814 uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
815
816 //if (attacker)
817 {
818 if (victim->IsAIEnabled)
819 victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask);
820
821 if (attacker && attacker->IsAIEnabled)
822 attacker->GetAI()->DamageDealt(victim, damage, damagetype);
823 }
824
825 // Hook for OnDamage Event
826 sScriptMgr->OnDamage(attacker, victim, damage);
827
828 if (victim->IsPlayer() && attacker != victim)
829 {
830 // Signal to pets that their owner was attacked
831 Pet* pet = victim->ToPlayer()->GetPet();
832
833 if (pet && pet->IsAlive())
834 pet->AI()->OwnerAttackedBy(attacker);
835 }
836
837 //Dont deal damage to unit if .cheat god is enable.
838 if (victim->IsPlayer())
839 {
840 if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
841 {
842 return 0;
843 }
844 }
845
846 // Signal the pet it was attacked so the AI can respond if needed
847 if (victim->IsCreature() && attacker != victim && victim->IsPet() && victim->IsAlive())
848 victim->ToPet()->AI()->AttackedBy(attacker);
849
850 if (damagetype != NODAMAGE)
851 {
852 // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
853 if (spellProto)
854 {
855 if (!spellProto->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
857 }
858 else
860
861 // interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots)
862 if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage)
863 {
864 if (victim != attacker && victim->IsPlayer())
865 {
866 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
867 {
868 if (spell->getState() == SPELL_STATE_PREPARING)
869 {
870 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
871 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
872 {
873 victim->InterruptNonMeleeSpells(false);
874 }
875 }
876 }
877 }
878 }
879
880 // We're going to call functions which can modify content of the list during iteration over it's elements
881 // Let's copy the list so we can prevent iterator invalidation
883 // copy damage to casters of this aura
884 for (AuraEffectList::iterator i = vCopyDamageCopy.begin(); i != vCopyDamageCopy.end(); ++i)
885 {
886 // Check if aura was removed during iteration - we don't need to work on such auras
887 if (!((*i)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
888 continue;
889 // check damage school mask
890 if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
891 continue;
892
893 Unit* shareDamageTarget = (*i)->GetCaster();
894 if (!shareDamageTarget)
895 continue;
896 SpellInfo const* spell = (*i)->GetSpellInfo();
897
898 uint32 shareDamage = CalculatePct(damage, (*i)->GetAmount());
899
900 uint32 shareAbsorb = 0;
901 uint32 shareResist = 0;
902
903 if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask))
904 {
905 shareAbsorb = shareDamage;
906 shareDamage = 0;
907 }
908 else
909 {
910 DamageInfo sharedDamageInfo(attacker, shareDamageTarget, shareDamage, spellProto, damageSchoolMask, damagetype);
911 Unit::CalcAbsorbResist(sharedDamageInfo, true);
912 shareAbsorb = sharedDamageInfo.GetAbsorb();
913 shareResist = sharedDamageInfo.GetResist();
914 shareDamage = sharedDamageInfo.GetDamage();
915 Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb);
916 }
917
918 if (attacker && shareDamageTarget->IsPlayer())
919 {
920 attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false, true);
921 }
922
923 Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false, false, damageSpell);
924 }
925 }
926
927 // Rage from Damage made (only from direct weapon damage)
928 if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->HasActivePowerType(POWER_RAGE))
929 {
930 uint32 weaponSpeedHitFactor;
931
932 switch (cleanDamage->attackType)
933 {
934 case BASE_ATTACK:
935 case OFF_ATTACK:
936 {
937 weaponSpeedHitFactor = uint32(attacker->GetAttackTime(cleanDamage->attackType) / 1000.0f * (cleanDamage->attackType == BASE_ATTACK ? 3.5f : 1.75f));
938 if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
939 weaponSpeedHitFactor *= 2;
940
941 attacker->RewardRage(rage_damage, weaponSpeedHitFactor, true);
942 break;
943 }
944 case RANGED_ATTACK:
945 break;
946 default:
947 break;
948 }
949 }
950
951 if (!damage)
952 {
953 // Rage from absorbed damage
954 if (cleanDamage && cleanDamage->absorbed_damage)
955 {
956 if (victim->HasActivePowerType(POWER_RAGE))
957 victim->RewardRage(cleanDamage->absorbed_damage, 0, false);
958
959 if (attacker && attacker->HasActivePowerType(POWER_RAGE))
960 attacker->RewardRage(cleanDamage->absorbed_damage, 0, true);
961 }
962
963 return 0;
964 }
965
966 LOG_DEBUG("entities.unit", "DealDamageStart");
967
968 uint32 health = victim->GetHealth();
969 LOG_DEBUG("entities.unit", "deal dmg:{} to health:{} ", damage, health);
970
971 // duel ends when player has 1 or less hp
972 bool duel_hasEnded = false;
973 bool duel_wasMounted = false;
974 if (victim->IsPlayer() && victim->ToPlayer()->duel && damage >= (health - 1))
975 {
976 // xinef: situation not possible earlier, just return silently.
977 if (!attacker)
978 return 0;
979
980 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
981 if (victim->ToPlayer()->duel->Opponent == attacker || victim->ToPlayer()->duel->Opponent->GetGUID() == attacker->GetOwnerGUID())
982 damage = health - 1;
983
984 duel_hasEnded = true;
985 }
986 else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->IsPlayer())
987 {
988 Player* victimRider = victim->GetCharmer()->ToPlayer();
989
990 if (victimRider && victimRider->duel && victimRider->duel->IsMounted)
991 {
992 // xinef: situation not possible earlier, just return silently.
993 if (!attacker)
994 return 0;
995
996 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
997 if (victimRider->duel->Opponent == attacker || victimRider->duel->Opponent->GetGUID() == attacker->GetCharmerGUID())
998 damage = health - 1;
999
1000 duel_wasMounted = true;
1001 duel_hasEnded = true;
1002 }
1003 }
1004
1005 if (attacker && attacker != victim)
1006 if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself())
1007 {
1008 // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so
1009 //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR)
1010 // return 0;
1011
1012 if (Battleground* bg = killer->GetBattleground())
1013 {
1014 bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
1015 killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization
1016 }
1017 //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization
1018 }
1019
1020 if (victim->IsPlayer())
1021 ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization
1022 else if (!victim->IsControlledByPlayer() || victim->IsVehicle())
1023 {
1024 if (!victim->ToCreature()->hasLootRecipient())
1025 victim->ToCreature()->SetLootRecipient(attacker);
1026
1027 if (!attacker || attacker->IsControlledByPlayer() || attacker->IsCreatedByPlayer())
1028 {
1029 uint32 unDamage = health < damage ? health : damage;
1030 bool damagedByPlayer = unDamage && attacker && (attacker->IsPlayer() || attacker->m_movedByPlayer != nullptr);
1031 victim->ToCreature()->LowerPlayerDamageReq(unDamage, damagedByPlayer);
1032 }
1033 }
1034
1035 if (health <= damage)
1036 {
1037 LOG_DEBUG("entities.unit", "DealDamage: victim just died");
1038
1039 //if (attacker && victim->IsPlayer() && victim != attacker)
1040 //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization
1041 Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell);
1042 }
1043 else
1044 {
1045 LOG_DEBUG("entities.unit", "DealDamageAlive");
1046
1047 //if (victim->IsPlayer())
1048 // victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); // pussywizard: optimization
1049
1050 victim->ModifyHealth(- (int32)damage);
1051
1052 if (damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
1053 victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
1054
1055 if (!victim->IsPlayer())
1056 {
1058 if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
1060
1061 if (attacker)
1062 {
1063 if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker))
1064 {
1065 victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPPRESS_TARGET_PROCS));
1066 }
1067
1068 victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto);
1069 }
1070 }
1071 else // victim is a player
1072 {
1073 // random durability for items (HIT TAKEN)
1075 {
1078 }
1079 }
1080
1081 // Rage from damage received
1082 if (attacker != victim && victim->HasActivePowerType(POWER_RAGE))
1083 {
1084 uint32 rageDamage = damage + (cleanDamage ? cleanDamage->absorbed_damage : 0);
1085 victim->RewardRage(rageDamage, 0, false);
1086 }
1087
1088 if (attacker && attacker->IsPlayer())
1089 {
1090 // random durability for items (HIT DONE)
1092 {
1094 attacker->ToPlayer()->DurabilityPointLossForEquipSlot(slot);
1095 }
1096 }
1097
1098 if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK))))
1099 {
1100 if (victim != attacker && victim->IsPlayer()) // does not support creature push_back
1101 {
1102 if (damagetype != DOT && !(damageSpell && damageSpell->m_targets.HasDstChannel()))
1103 {
1104 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
1105 {
1106 if (spell->getState() == SPELL_STATE_PREPARING)
1107 {
1108 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
1109 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
1110 {
1111 victim->InterruptNonMeleeSpells(false);
1112 }
1113 else if (interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK)
1114 {
1115 spell->Delayed();
1116 }
1117 }
1118 }
1119
1120 if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
1121 if (spell->getState() == SPELL_STATE_CASTING)
1122 {
1123 if ((spell->m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_DELAY) != 0)
1124 {
1125 spell->DelayedChannel();
1126 }
1127 }
1128 }
1129 }
1130 }
1131
1132 // last damage from duel opponent
1133 if (duel_hasEnded)
1134 {
1135 Player* he = duel_wasMounted ? victim->GetCharmer()->ToPlayer() : victim->ToPlayer();
1136
1137 ASSERT_NODEBUGINFO(he && he->duel);
1138
1139 if (duel_wasMounted) // In this case victim==mount
1140 victim->SetHealth(1);
1141 else
1142 he->SetHealth(1);
1143
1144 he->duel->Opponent->CombatStopWithPets(true);
1145 he->CombatStopWithPets(true);
1146
1147 he->CastSpell(he, 7267, true); // beg
1149 }
1150 }
1151
1152 LOG_DEBUG("entities.unit", "DealDamageEnd returned {} damage", damage);
1153
1154 return damage;
1155}
@ SCORE_DAMAGE_DONE
Definition BattlegroundScore.h:32
@ ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE
Definition DBCEnums.h:130
#define ASSERT_NODEBUGINFO
Definition Errors.h:69
@ RATE_DURABILITY_LOSS_DAMAGE
Definition IWorld.h:516
@ CHEAT_GOD
Definition Player.h:1004
EquipmentSlots
Definition Player.h:678
@ EQUIPMENT_SLOT_END
Definition Player.h:699
bool roll_chance_f(float chance)
Definition Random.h:53
@ POWER_RAGE
Definition SharedDefines.h:270
@ SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK
Definition SharedDefines.h:647
@ SPELL_ATTR3_TREAT_AS_PERIODIC
Definition SharedDefines.h:518
@ SPELL_ATTR3_SUPPRESS_TARGET_PROCS
Definition SharedDefines.h:510
@ DUEL_WON
Definition SharedDefines.h:3613
@ SPELL_ATTR4_REACTIVE_DAMAGE_PROC
Definition SharedDefines.h:544
@ SPELL_AURA_DAMAGE_SHIELD
Definition SpellAuraDefines.h:78
@ SPELL_AURA_SHARE_DAMAGE_PCT
Definition SpellAuraDefines.h:363
@ CHANNEL_FLAG_DELAY
Definition SpellDefines.h:38
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition SpellDefines.h:44
@ AURA_INTERRUPT_FLAG_DIRECT_DAMAGE
Definition SpellDefines.h:67
@ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG
Definition SpellDefines.h:30
@ SPELL_INTERRUPT_FLAG_PUSH_BACK
Definition SpellDefines.h:27
@ SPELL_STATE_PREPARING
Definition Spell.h:227
@ SPELL_STATE_CASTING
Definition Spell.h:228
@ NODAMAGE
Definition Unit.h:252
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:539
@ CURRENT_GENERIC_SPELL
Definition Unit.h:538
virtual void OwnerAttackedBy(Unit *)
Definition CreatureAI.h:173
virtual void AttackedBy(Unit *)
Definition CreatureAI.h:150
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition Creature.cpp:1320
bool hasLootRecipient() const
Definition Creature.h:231
void UpdateLeashExtensionTime()
Definition Creature.cpp:3713
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition Creature.cpp:3806
bool IsPlayer() const
Definition ObjectGuid.h:168
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition PlayerUpdates.cpp:2131
void DurabilityPointLossForEquipSlot(EquipmentSlots slot)
Definition Player.cpp:4835
Pet * GetPet() const
Definition Player.cpp:8939
bool GetCommandStatus(uint32 command) const
Definition Player.h:1195
uint32 ChannelInterruptFlags
Definition SpellInfo.h:354
uint32 InterruptFlags
Definition SpellInfo.h:352
virtual void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Called at any Damage from any attacker (before damage apply)
Definition UnitAI.h:369
virtual void DamageDealt(Unit *, uint32 &, DamageEffectType)
Called at any Damage to any victim (before damage apply)
Definition UnitAI.h:362
int32 ModifyHealth(int32 val)
Definition Unit.cpp:14114
Pet * ToPet()
Definition Unit.h:700
bool IsCreatedByPlayer() const
Definition Unit.h:1239
Unit * GetCharmer() const
Definition Unit.cpp:10631
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.cpp:17725
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
Definition Unit.cpp:20159
void SetHealth(uint32 val)
Definition Unit.cpp:15501
ObjectGuid GetCharmerGUID() const
Definition Unit.h:690
virtual bool HasActivePowerType(Powers power)
Definition Unit.h:1059
void CombatStopWithPets(bool includingCast=false)
Definition Unit.cpp:10477

References CleanDamage::absorbed_damage, ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, AddThreat(), Creature::AI(), ASSERT_NODEBUGINFO, CreatureAI::AttackedBy(), CleanDamage::attackType, SpellInfo::AttributesEx3, AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, AURA_INTERRUPT_FLAG_TAKE_DAMAGE, BASE_ATTACK, CalcAbsorbResist(), CalculatePct(), CanHaveThreatList(), CastSpell(), CHANNEL_FLAG_DELAY, CHEAT_GOD, CombatStart(), CombatStopWithPets(), CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, UnitAI::DamageDealt(), UnitAI::DamageTaken(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, DOT, Player::duel, DUEL_WON, Player::DuelComplete(), Player::DurabilityPointLossForEquipSlot(), EQUIPMENT_SLOT_END, DamageInfo::GetAbsorb(), GetAI(), GetAttackTime(), GetAuraEffectsByType(), GetCharmer(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), Player::GetCommandStatus(), DamageInfo::GetDamage(), Object::GetGUID(), GetHealth(), GetOwnerGUID(), Player::GetPet(), DamageInfo::GetResist(), HasActivePowerType(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellCastTargets::HasDstChannel(), Creature::hasLootRecipient(), HasUnitState(), CleanDamage::hitOutCome, SpellInfo::Id, InterruptNonMeleeSpells(), IsAIEnabled, IsAlive(), IsControlledByPlayer(), IsCreatedByPlayer(), Object::IsCreature(), IsImmunedToDamageOrSchool(), IsInCombatWith(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), IsVehicle(), Kill(), LOG_DEBUG, Creature::LowerPlayerDamageReq(), m_currentSpells, m_movedByPlayer, Spell::m_targets, MELEE_HIT_CRIT, ModifyHealth(), NODAMAGE, OFF_ATTACK, CreatureAI::OwnerAttackedBy(), POWER_RAGE, RANGED_ATTACK, RATE_DURABILITY_LOSS_DAMAGE, RemoveAurasWithInterruptFlags(), RewardRage(), roll_chance_f(), SCORE_DAMAGE_DONE, SendSpellNonMeleeDamageLog(), SetHealth(), Creature::SetLootRecipient(), SPELL_ATTR3_SUPPRESS_TARGET_PROCS, SPELL_ATTR3_TREAT_AS_PERIODIC, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_SHARE_DAMAGE_PCT, SPELL_DIRECT_DAMAGE, SPELL_INTERRUPT_FLAG_ABORT_ON_DMG, SPELL_INTERRUPT_FLAG_PUSH_BACK, SPELL_STATE_CASTING, SPELL_STATE_PREPARING, sScriptMgr, sWorld, Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_STATE_EVADE, Player::UpdateAchievementCriteria(), Creature::UpdateLeashExtensionTime(), and urand().

Referenced by CalcAbsorbResist(), DealDamage(), DealMeleeDamage(), DealSpellDamage(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectInstaKill(), Player::EnvironmentalDamage(), spell_mt_phoenix_burn::HandleAfterCast(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), spell_svala_ritual_strike::HandleDummyEffect(), spell_valkyr_touch_aura::HandleEffectPeriodic(), spell_lady_vashj_magic_barrier::HandleEffectRemove(), spell_algalon_collapse_aura::HandlePeriodic(), spell_kaelthas_burn::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_gluth_decimate::HandleScriptEffect(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ DealDamageMods()

void Unit::DealDamageMods ( Unit const *  victim,
uint32 damage,
uint32 absorb 
)
static

◆ DealHeal()

int32 Unit::DealHeal ( Unit healer,
Unit victim,
uint32  addhealth 
)
static
10975{
10976 int32 gain = 0;
10977
10978 if (healer)
10979 {
10980 if (victim->IsAIEnabled)
10981 victim->GetAI()->HealReceived(healer, addhealth);
10982
10983 if (healer->IsAIEnabled)
10984 healer->GetAI()->HealDone(victim, addhealth);
10985 }
10986
10987 if (addhealth)
10988 gain = victim->ModifyHealth(int32(addhealth));
10989
10990 // Hook for OnHeal Event
10991 sScriptMgr->OnHeal(healer, victim, (uint32&)gain);
10992
10993 Unit* unit = healer;
10994
10995 if (healer && healer->IsCreature() && healer->ToCreature()->IsTotem())
10996 unit = healer->GetOwner();
10997
10998 if (!unit)
10999 return gain;
11000
11001 if (Player* player = unit->ToPlayer())
11002 {
11003 if (Battleground* bg = player->GetBattleground())
11004 bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
11005
11006 // use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
11007 if (gain && player->InBattleground()) // pussywizard: InBattleground() optimization
11008 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
11009
11010 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth); // pussywizard: optimization
11011 }
11012
11013 /*if (Player* player = victim->ToPlayer())
11014 {
11015 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); // pussywizard: optimization
11016 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); // pussywizard: optimization
11017 }*/
11018
11019 return gain;
11020}
@ SCORE_HEALING_DONE
Definition BattlegroundScore.h:33
@ ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE
Definition DBCEnums.h:169
virtual void HealReceived(Unit *, uint32 &)
Called when the creature receives heal.
Definition UnitAI.h:372
virtual void HealDone(Unit *, uint32 &)
Called when the unit heals.
Definition UnitAI.h:378

References ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, GetAI(), GetOwner(), UnitAI::HealDone(), UnitAI::HealReceived(), IsAIEnabled, Object::IsCreature(), IsTotem(), ModifyHealth(), SCORE_HEALING_DONE, sScriptMgr, Object::ToCreature(), and Object::ToPlayer().

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), HealBySpell(), and npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI().

◆ DealMeleeDamage()

void Unit::DealMeleeDamage ( CalcDamageInfo damageInfo,
bool  durabilityLoss 
)
Todo:
: Move this to a packet handler
1830{
1831 Unit* victim = damageInfo->target;
1832
1833 auto canTakeMeleeDamage = [&]()
1834 {
1835 return victim->IsAlive() && !victim->HasUnitState(UNIT_STATE_IN_FLIGHT) && (!victim->IsCreature() || !victim->ToCreature()->IsEvadingAttacks());
1836 };
1837
1838 if (!canTakeMeleeDamage())
1839 {
1840 return;
1841 }
1842
1843 // Hmmmm dont like this emotes client must by self do all animations
1844 if (damageInfo->HitInfo & HITINFO_CRITICALHIT)
1846 if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
1848
1849 // Parry haste is enabled if it's not a creature or if the creature doesn't have the NO_PARRY_HASTEN flag.
1850 bool isParryHasteEnabled = !victim->IsCreature() ||
1852 if (damageInfo->TargetState == VICTIMSTATE_PARRY && isParryHasteEnabled)
1853 {
1854 // Get attack timers
1855 float offtime = float(victim->getAttackTimer(OFF_ATTACK));
1856 float basetime = float(victim->getAttackTimer(BASE_ATTACK));
1857 // Reduce attack time
1858 if (victim->HasOffhandWeaponForAttack() && offtime < basetime)
1859 {
1860 float percent20 = victim->GetAttackTime(OFF_ATTACK) * 0.20f;
1861 float percent60 = 3.0f * percent20;
1862 if (offtime > percent20 && offtime <= percent60)
1863 victim->setAttackTimer(OFF_ATTACK, uint32(percent20));
1864 else if (offtime > percent60)
1865 {
1866 offtime -= 2.0f * percent20;
1867 victim->setAttackTimer(OFF_ATTACK, uint32(offtime));
1868 }
1869 }
1870 else
1871 {
1872 float percent20 = victim->GetAttackTime(BASE_ATTACK) * 0.20f;
1873 float percent60 = 3.0f * percent20;
1874 if (basetime > percent20 && basetime <= percent60)
1875 victim->setAttackTimer(BASE_ATTACK, uint32(percent20));
1876 else if (basetime > percent60)
1877 {
1878 basetime -= 2.0f * percent20;
1879 victim->setAttackTimer(BASE_ATTACK, uint32(basetime));
1880 }
1881 }
1882 }
1883
1884 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1885 {
1886 if (!canTakeMeleeDamage() || (!damageInfo->damages[i].damage && !damageInfo->damages[i].absorb && !damageInfo->damages[i].resist))
1887 {
1888 continue;
1889 }
1890
1891 // Call default DealDamage
1892 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->damages[i].absorb, damageInfo->attackType, damageInfo->hitOutCome);
1893 Unit::DealDamage(this, victim, damageInfo->damages[i].damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damages[i].damageSchoolMask), nullptr, durabilityLoss);
1894 }
1895
1896 // gain rage if attack is fully blocked, dodged or parried
1898 {
1899 switch (damageInfo->attackType)
1900 {
1901 case BASE_ATTACK:
1902 case OFF_ATTACK:
1903 {
1904 uint32 weaponSpeedHitFactor = uint32(GetAttackTime(damageInfo->attackType) / 1000.0f * (damageInfo->attackType == BASE_ATTACK ? 3.5f : 1.75f));
1905 RewardRage(damageInfo->cleanDamage, weaponSpeedHitFactor, true);
1906 break;
1907 }
1908 default:
1909 break;
1910 }
1911 }
1912
1913 // If this is a creature and it attacks from behind it has a probability to daze it's victim
1914 if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
1915 !IsPlayer() && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
1916 && (victim->IsPlayer() || !victim->ToCreature()->isWorldBoss()) && !victim->IsVehicle()))
1917 {
1918 // -probability is between 0% and 40%
1919 // 20% base chance
1920 float Probability = 20.0f;
1921
1922 // there is a newbie protection, at level 10 just 7% base chance; assuming linear function
1923 if (victim->GetLevel() < 30)
1924 Probability = 0.65f * victim->GetLevel() + 0.5f;
1925
1926 uint32 VictimDefense = victim->GetDefenseSkillValue();
1927 uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
1928
1929 // xinef: fix daze mechanics
1930 Probability -= ((float)VictimDefense - AttackerMeleeSkill) * 0.1428f;
1931
1932 if (Probability > 40.0f)
1933 Probability = 40.0f;
1934
1935 // Daze application
1936 if (sWorld->getBoolConfig(CONFIG_ENABLE_DAZE))
1937 if (roll_chance_f(std::max(0.0f, Probability)))
1938 CastSpell(victim, 1604, true);
1939 }
1940
1941 if (IsPlayer())
1942 ToPlayer()->CastItemCombatSpell(victim, damageInfo->attackType, damageInfo->procVictim, damageInfo->procEx);
1943
1944 // Do effect if any damage done to target
1945 if (damageInfo->damages[0].damage + damageInfo->damages[1].damage)
1946 {
1947 // We're going to call functions which can modify content of the list during iteration over it's elements
1948 // Let's copy the list so we can prevent iterator invalidation
1950 for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
1951 {
1952 SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
1953 // Damage shield can be resisted...
1954 if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false))
1955 {
1956 victim->SendSpellMiss(this, i_spellProto->Id, missInfo);
1957 continue;
1958 }
1959
1960 // ...or immuned
1961 if (IsImmunedToDamageOrSchool(i_spellProto))
1962 {
1963 victim->SendSpellDamageImmune(this, i_spellProto->Id);
1964 continue;
1965 }
1966
1967 uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation
1968
1969 if (Unit* caster = (*dmgShieldItr)->GetCaster())
1970 {
1971 damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex());
1972 damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
1973 }
1974
1975 uint32 absorb = 0;
1976
1977 DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE);
1978 Unit::CalcAbsorbResist(dmgInfo);
1979 absorb = dmgInfo.GetAbsorb();
1980 damage = dmgInfo.GetDamage();
1981
1982 Unit::DealDamageMods(this, damage, &absorb);
1983
1985 WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4));
1986 data << victim->GetGUID();
1987 data << GetGUID();
1988 data << uint32(i_spellProto->Id);
1989 data << uint32(damage); // Damage
1990 int32 overkill = int32(damage) - int32(GetHealth());
1991 data << uint32(overkill > 0 ? overkill : 0); // Overkill
1992 data << uint32(i_spellProto->GetSchoolMask());
1993 victim->SendMessageToSet(&data, true);
1994
1995 Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true);
1996 }
1997 }
1998}
@ CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN
Definition CreatureData.h:48
@ CONFIG_ENABLE_DAZE
Definition IWorld.h:185
@ EMOTE_ONESHOT_WOUND_CRITICAL
Definition SharedDefines.h:1924
@ EMOTE_ONESHOT_PARRY_SHIELD
Definition SharedDefines.h:1930
SpellMissInfo
Definition SharedDefines.h:1518
bool isWorldBoss() const
Definition Creature.h:120
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition Player.cpp:7232
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1987
uint32 GetUnitMeleeSkill(Unit const *target=nullptr) const
Definition Unit.h:1118
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
Definition Unit.cpp:6468
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition Unit.cpp:3625
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition Unit.cpp:6492
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition Unit.cpp:3470
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:11814
void HandleEmoteCommand(uint32 emoteId)
Definition Unit.cpp:2000
@ SMSG_SPELLDAMAGESHIELD
Definition Opcodes.h:621
bool HasFlagsExtra(uint32 flag) const
Definition CreatureData.h:283
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition Position.cpp:141

References CalcDamageInfo::absorb, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcAbsorbResist(), Player::CastItemCombatSpell(), CastSpell(), CalcDamageInfo::cleanDamage, CONFIG_ENABLE_DAZE, CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DealDamage(), DealDamageMods(), DIRECT_DAMAGE, EMOTE_ONESHOT_PARRY_SHIELD, EMOTE_ONESHOT_WOUND_CRITICAL, DamageInfo::GetAbsorb(), GetAttackTime(), getAttackTimer(), GetAuraEffectsByType(), Creature::GetCreatureTemplate(), DamageInfo::GetDamage(), GetDefenseSkillValue(), Object::GetGUID(), Object::GetGUID(), GetHealth(), GetLevel(), SpellInfo::GetSchoolMask(), GetUnitMeleeSkill(), HandleEmoteCommand(), HasActivePowerType(), CreatureTemplate::HasFlagsExtra(), Position::HasInArc(), HasOffhandWeaponForAttack(), HasUnitState(), CalcDamageInfo::HitInfo, HITINFO_CRITICALHIT, CalcDamageInfo::hitOutCome, SpellInfo::Id, IsAlive(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsImmunedToDamageOrSchool(), Object::IsPlayer(), IsVehicle(), Creature::isWorldBoss(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_GLANCING, MELEE_HIT_NORMAL, OFF_ATTACK, POWER_RAGE, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, CalcDamageInfo::resist, RewardRage(), roll_chance_f(), WorldObject::SendMessageToSet(), SendSpellDamageImmune(), SendSpellMiss(), setAttackTimer(), SMSG_SPELLDAMAGESHIELD, SPELL_AURA_DAMAGE_SHIELD, SPELL_DIRECT_DAMAGE, SpellDamageBonusTaken(), SpellHitResult(), sWorld, CalcDamageInfo::target, CalcDamageInfo::TargetState, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_IN_FLIGHT, VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ DealSpellDamage()

void Unit::DealSpellDamage ( SpellNonMeleeDamage damageInfo,
bool  durabilityLoss,
Spell const *  spell = nullptr 
)
1439{
1440 if (damageInfo == 0)
1441 return;
1442
1443 Unit* victim = damageInfo->target;
1444
1445 if (!victim)
1446 return;
1447
1448 if (!victim->IsAlive() || victim->IsInFlight() || (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks()))
1449 return;
1450
1451 SpellInfo const* spellProto = damageInfo->spellInfo;
1452 if (!spellProto)
1453 {
1454 LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo");
1455 return;
1456 }
1457
1458 // Call default DealDamage
1459 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
1460 Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell);
1461}
bool IsInFlight() const
Definition Unit.h:1622
SpellInfo const * spellInfo
Definition Unit.h:497

References SpellNonMeleeDamage::absorb, BASE_ATTACK, SpellNonMeleeDamage::cleanDamage, SpellNonMeleeDamage::damage, DealDamage(), IsAlive(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsInFlight(), LOG_DEBUG, MELEE_HIT_NORMAL, SpellNonMeleeDamage::schoolMask, SPELL_DIRECT_DAMAGE, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, and Object::ToCreature().

Referenced by Spell::DoAllEffectOnTarget(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ DelayOwnedAuras()

void Unit::DelayOwnedAuras ( uint32  spellId,
ObjectGuid  caster,
int32  delaytime 
)
5463{
5464 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5465 for (; range.first != range.second; ++range.first)
5466 {
5467 Aura* aura = range.first->second;
5468 if (!caster || aura->GetCasterGUID() == caster)
5469 {
5470 if (aura->GetDuration() < delaytime)
5471 aura->SetDuration(0);
5472 else
5473 aura->SetDuration(aura->GetDuration() - delaytime);
5474
5475 // update for out of range group members (on 1 slot use)
5477 LOG_DEBUG("spells.aura", "Aura {} partially interrupted on unit {}, new duration: {} ms", aura->GetId(), GetGUID().ToString(), aura->GetDuration());
5478 }
5479 }
5480}
int32 GetDuration() const
Definition SpellAuras.h:133
void SetNeedClientUpdateForTargets() const
Definition SpellAuras.cpp:1258
void SetDuration(int32 duration, bool withMods=false)
Definition SpellAuras.cpp:868
std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
Definition Unit.h:643

References Aura::GetCasterGUID(), Aura::GetDuration(), Object::GetGUID(), Aura::GetId(), LOG_DEBUG, m_ownedAuras, Aura::SetDuration(), Aura::SetNeedClientUpdateForTargets(), and Position::ToString().

◆ DeleteCharmInfo()

void Unit::DeleteCharmInfo ( )
15843{
15844 if (!m_charmInfo)
15845 return;
15846
15848 delete m_charmInfo;
15849 m_charmInfo = nullptr;
15850}
void RestoreState()
Definition CharmInfo.cpp:46

References m_charmInfo, and CharmInfo::RestoreState().

Referenced by RemoveCharmedBy().

◆ DeMorph()

void Unit::DeMorph ( )
4350{
4352}
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition Unit.cpp:16785
uint32 GetNativeDisplayId() const
Definition Unit.h:1889

References GetNativeDisplayId(), and SetDisplayId().

Referenced by modify_commandscript::HandleMorphResetCommand().

◆ DisableRotate()

void Unit::DisableRotate ( bool  apply)
18299{
18300 if (!IsCreature())
18301 return;
18302
18303 if (apply)
18307}
@ UNIT_STATE_POSSESSED
Definition UnitDefines.h:186
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:719

References HasUnitState(), Object::IsCreature(), RemoveUnitFlag(), SetUnitFlag(), UNIT_FLAG_POSSESSED, and UNIT_STATE_POSSESSED.

Referenced by boss_ingvar_the_plunderer::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_anub_arak::boss_anub_arakAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::boss_ignisAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), boss_ingvar_the_plunderer::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::boss_ignisAI::Reset(), boss_kologarn::boss_kologarnAI::Reset(), boss_ingvar_the_plunderer::Reset(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ DisableSpline()

◆ Dismount()

void Unit::Dismount ( )
13548{
13549 if (!IsMounted())
13550 return;
13551
13554
13555 if (Player* thisPlayer = ToPlayer())
13556 {
13557 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
13558 data << GetPackGUID();
13559 data << uint32(GameTime::GetGameTime().count()); // Packet counter
13560 data << thisPlayer->GetCollisionHeight();
13561 thisPlayer->GetSession()->SendPacket(&data);
13562 }
13563
13564 WorldPacket data(SMSG_DISMOUNT, 8);
13565 data << GetPackGUID();
13566 SendMessageToSet(&data, true);
13567
13568 // dismount as a vehicle
13569 if (IsPlayer() && GetVehicleKit())
13570 {
13571 // Send other players that we are no longer a vehicle
13572 data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8 + 4);
13573 data << GetPackGUID();
13574 data << uint32(0);
13575 ToPlayer()->SendMessageToSet(&data, true);
13576 // Remove vehicle from player
13578 }
13579
13581
13582 // only resummon old pet if the player is already added to a map
13583 // this prevents adding a pet to a not created map which would otherwise cause a crash
13584 // (it could probably happen when logging in after a previous crash)
13585 if (Player* player = ToPlayer())
13586 {
13587 sScriptMgr->AnticheatSetUnderACKmount(player);
13588
13589 if (Pet* pPet = player->GetPet())
13590 {
13591 if (pPet->HasUnitFlag(UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
13592 pPet->RemoveUnitFlag(UNIT_FLAG_STUNNED);
13593 }
13594 else
13595 player->ResummonPetTemporaryUnSummonedIfAny();
13596
13597 // xinef: if we have charmed npc, remove stun also
13598 if (Unit* charm = player->GetCharm())
13599 if (charm->IsCreature() && !charm->HasUnitState(UNIT_STATE_STUNNED))
13600 charm->RemoveUnitFlag(UNIT_FLAG_STUNNED);
13601 }
13602}
@ AURA_INTERRUPT_FLAG_NOT_MOUNTED
Definition SpellDefines.h:49
@ UNIT_FLAG_STUNNED
Definition UnitDefines.h:268
@ UNIT_FLAG_MOUNT
Definition UnitDefines.h:277
@ UNIT_FIELD_MOUNTDISPLAYID
Definition UpdateFields.h:126
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition Player.cpp:5687
void RemoveVehicleKit()
Definition Unit.cpp:18750
@ SMSG_PLAYER_VEHICLE_DATA
Definition Opcodes.h:1221
@ SMSG_MOVE_SET_COLLISION_HGT
Definition Opcodes.h:1332
@ SMSG_DISMOUNT
Definition Opcodes.h:970

References AURA_INTERRUPT_FLAG_NOT_MOUNTED, GetCharm(), GameTime::GetGameTime(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), IsMounted(), Object::IsPlayer(), RemoveAurasWithInterruptFlags(), RemoveUnitFlag(), RemoveVehicleKit(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), SetUInt32Value(), SMSG_DISMOUNT, SMSG_MOVE_SET_COLLISION_HGT, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, UNIT_FLAG_STUNNED, and UNIT_STATE_STUNNED.

Referenced by _EnterVehicle(), Player::CleanupAfterTaxiFlight(), FlightPathMovementGenerator::DoFinalize(), BattlegroundWS::EventPlayerClickedOnFlag(), AuraEffect::HandleAuraMounted(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), npc_scarlet_courier::npc_scarlet_courierAI::JustEngagedWith(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), boss_captain_skarloc::MovementInform(), spell_chapter5_light_of_dawn_aura::OnApply(), Creature::setDeathState(), SetInCombatState(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_magister_aledis::StartFight(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ EnergizeBySpell()

void Unit::EnergizeBySpell ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
11295{
11296 int32 gainedPower = victim->ModifyPower(powerType, damage, false);
11297
11298 if (powerType != POWER_HAPPINESS && gainedPower)
11299 {
11300 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
11301 victim->getHostileRefMgr().threatAssist(this, float(gainedPower) * 0.5f, spellInfo);
11302 }
11303
11304 SendEnergizeSpellLog(victim, spellID, damage, powerType);
11305}
@ POWER_HAPPINESS
Definition SharedDefines.h:273
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition HostileRefMgr.cpp:35
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition Unit.cpp:11283

References getHostileRefMgr(), ModifyPower(), POWER_HAPPINESS, SendEnergizeSpellLog(), sSpellMgr, and HostileRefMgr::threatAssist().

Referenced by Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerDrain(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ EnterVehicle()

void Unit::EnterVehicle ( Unit base,
int8  seatId = -1 
)
19663{
19665
19666 if (Player* player = ToPlayer())
19667 {
19668 sScriptMgr->AnticheatSetUnderACKmount(player);
19669 }
19670}
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition SpellDefines.h:146
@ VEHICLE_SPELL_RIDE_HARDCODED
Definition VehicleDefines.h:52

References CastCustomSpell(), SPELLVALUE_BASE_POINT0, sScriptMgr, Object::ToPlayer(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, and VEHICLE_SPELL_RIDE_HARDCODED.

Referenced by debug_commandscript::HandleDebugEnterVehicleCommand(), WorldSession::HandleEnterPlayerVehicle(), boss_mimiron::boss_mimironAI::JustEngagedWith(), npc_pilgrims_bounty_chair::UpdateAI(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ EnterVehicleUnattackable()

void Unit::EnterVehicleUnattackable ( Unit base,
int8  seatId = -1 
)

◆ ExecuteDelayedUnitAINotifyEvent()

void Unit::ExecuteDelayedUnitAINotifyEvent ( )
20534{
20536 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
20537 return;
20538
20539 Acore::AIRelocationNotifier notifier(*this);
20540 float radius = 60.0f;
20541 Cell::VisitAllObjects(this, notifier, radius);
20542}
@ NOTIFY_AI_RELOCATION
Definition Object.h:67
void RemoveFromNotify(uint16 f)
Definition Object.h:573
Definition GridNotifiers.h:91
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:206

References IsDuringRemoveFromWorld(), Object::IsInWorld(), NOTIFY_AI_RELOCATION, WorldObject::RemoveFromNotify(), and Cell::VisitAllObjects().

Referenced by Update().

◆ ExecuteDelayedUnitRelocationEvent()

void Unit::ExecuteDelayedUnitRelocationEvent ( )
20427{
20429 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
20430 return;
20431
20432 if (this->HasSharedVision())
20433 for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr)
20434 if (Player* player = (*itr))
20435 {
20436 if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation)
20437 continue;
20438 WorldObject* viewPoint = player;
20439 if (player->m_seer && player->m_seer->IsInWorld())
20440 viewPoint = player->m_seer;
20441 if (!viewPoint->IsPositionValid() || !player->IsPositionValid())
20442 continue;
20443
20444 if (Unit* active = viewPoint->ToUnit())
20445 {
20446 //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated
20447 // active = player;
20448
20449 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
20450 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
20451 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
20452 float distsq = dx * dx + dy * dy + dz * dz;
20453 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
20454 if (distsq < mindistsq)
20455 continue;
20456
20457 // this will be relocated below sharedvision!
20458 //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
20459 }
20460
20461 Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
20462 Cell::VisitAllObjects(viewPoint, relocateNoLarge, player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
20463 relocateNoLarge.SendToSelf();
20464 Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
20465 Cell::VisitAllObjects(viewPoint, relocateLarge, MAX_VISIBILITY_DISTANCE);
20466 relocateLarge.SendToSelf();
20467 }
20468
20469 if (Player* player = this->ToPlayer())
20470 {
20471 WorldObject* viewPoint = player;
20472 if (player->m_seer && player->m_seer->IsInWorld())
20473 viewPoint = player->m_seer;
20474
20475 if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid())
20476 return;
20477
20478 if (Unit* active = viewPoint->ToUnit())
20479 {
20480 if (active->IsVehicle())
20481 active = player;
20482
20483 if (!player->GetFarSightDistance())
20484 {
20485 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
20486 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
20487 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
20488 float distsq = dx * dx + dy * dy + dz * dz;
20489
20490 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
20491 if (distsq < mindistsq)
20492 return;
20493
20494 active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
20495 }
20496 }
20497
20498 Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
20499 Cell::VisitAllObjects(viewPoint, relocateNoLarge, player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
20500 relocateNoLarge.SendToSelf();
20501
20502 if (!player->GetFarSightDistance())
20503 {
20504 Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
20505 Cell::VisitAllObjects(viewPoint, relocateLarge, MAX_VISIBILITY_DISTANCE);
20506 relocateLarge.SendToSelf();
20507 }
20508
20510 }
20511 else if (Creature* unit = this->ToCreature())
20512 {
20513 if (!unit->IsPositionValid())
20514 return;
20515
20516 float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX();
20517 float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY();
20518 float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ();
20519 float distsq = dx * dx + dy * dy + dz * dz;
20520 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type);
20521 if (distsq < mindistsq)
20522 return;
20523
20524 unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
20525
20526 Acore::CreatureRelocationNotifier relocate(*unit);
20527 Cell::VisitAllObjects(unit, relocate, unit->GetVisibilityRange() + VISIBILITY_COMPENSATION);
20528
20530 }
20531}
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:31
#define VISIBILITY_INC_FOR_GOBJECTS
Definition ObjectDefines.h:28
#define VISIBILITY_COMPENSATION
Definition ObjectDefines.h:26
@ NOTIFY_VISIBILITY_CHANGED
Definition Object.h:68
static float GetReqMoveDistSq(uint32 map_type)
Definition DynamicVisibility.h:53
Unit * ToUnit()
Definition Object.h:209
SharedVisionList const & GetSharedVisionList()
Definition Unit.h:1787
bool HasSharedVision() const
Definition Unit.h:1790
uint32 GetMapId() const
Definition Position.h:275
void AddToNotify(uint16 f)
Definition Object.cpp:2991
Definition GridNotifiers.h:83
Definition GridNotifiers.h:75
bool IsPositionValid() const
Definition Position.cpp:176

References WorldObject::AddToNotify(), WorldLocation::GetMapId(), Position::GetPositionX(), DynamicVisibilityMgr::GetReqMoveDistSq(), GetSharedVisionList(), HasSharedVision(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Position::IsPositionValid(), MAX_VISIBILITY_DISTANCE, NOTIFY_AI_RELOCATION, NOTIFY_VISIBILITY_CHANGED, WorldObject::RemoveFromNotify(), Acore::VisibleNotifier::SendToSelf(), Object::ToCreature(), Object::ToPlayer(), Object::ToUnit(), VISIBILITY_COMPENSATION, VISIBILITY_INC_FOR_GOBJECTS, and Cell::VisitAllObjects().

◆ ExitVehicle()

void Unit::ExitVehicle ( Position const *  exitPosition = nullptr)

This function can be called at upper level code to initialize an exit from the passenger's side.

The following call would not even be executed successfully as the SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without specifying an exitposition. The subsequent call below would return on if (!m_vehicle).

To do: We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts to specify exit coordinates and either store those per passenger, or we need to init spline movement based on those coordinates in unapply handlers, and relocate exiting passengers based on Unit::moveSpline data. Either way, Coming Soon(TM)

19759{
19761 if (!m_vehicle)
19762 return;
19763
19765 if (Player* player = ToPlayer())
19766 {
19767 player->SetCanTeleport(true);
19768 }
19772 /*_ExitVehicle(exitPosition);*/
19779
19780 if (Player* player = ToPlayer())
19781 {
19782 sScriptMgr->AnticheatSetUnderACKmount(player);
19783 }
19784}
Unit * GetVehicleBase() const
Definition Unit.cpp:18765

References Object::GetGUID(), GetVehicleBase(), m_vehicle, RemoveAurasByType(), SPELL_AURA_CONTROL_VEHICLE, sScriptMgr, and Object::ToPlayer().

Referenced by _EnterVehicle(), Player::ActivateTaxiPathTo(), boss_mimiron::boss_mimironAI::EnterEvadeMode(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::EnterEvadeMode(), npc_ulduar_vx001::npc_ulduar_vx001AI::EnterEvadeMode(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::EnterEvadeMode(), WorldSession::HandleDismissControlledVehicle(), spell_warhead_detonate::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_ulduar_squeezed_lifeless::HandleInstaKill(), WorldSession::HandleRequestVehicleExit(), spell_vehicle_throw_passenger::HandleScript(), boss_kologarn_arms::boss_kologarn_armsAI::JustDied(), Player::ProcessDelayedOperations(), RemoveFromWorld(), Player::StopCastingCharm(), and Player::TeleportTo().

◆ FindCurrentSpellBySpellId()

◆ FinishSpell()

void Unit::FinishSpell ( CurrentSpellTypes  spellType,
bool  ok = true 
)
4088{
4089 Spell* spell = m_currentSpells[spellType];
4090 if (!spell)
4091 return;
4092
4093 if (spellType == CURRENT_CHANNELED_SPELL)
4094 spell->SendChannelUpdate(0);
4095
4096 spell->finish(ok);
4097}
void SendChannelUpdate(uint32 time)
Definition Spell.cpp:5196

References CURRENT_CHANNELED_SPELL, Spell::finish(), m_currentSpells, and Spell::SendChannelUpdate().

Referenced by AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), npc_risen_archmage::npc_risen_archmageAI::JustEngagedWith(), boss_lord_marrowgar::UpdateAI(), and GameObject::Use().

◆ GetAffectingPlayer()

Player * Unit::GetAffectingPlayer ( ) const
10649{
10650 if (!GetCharmerOrOwnerGUID())
10651 return const_cast<Unit*>(this)->ToPlayer();
10652
10653 if (Unit* owner = GetCharmerOrOwner())
10655
10656 return nullptr;
10657}
Unit * GetCharmerOrOwner() const
Definition Unit.h:1217
ObjectGuid GetCharmerOrOwnerGUID() const
Definition Unit.h:1226

References GetCharmerOrOwner(), GetCharmerOrOwnerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), and Object::ToPlayer().

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), GetFactionReactionTo(), and GetReactionTo().

◆ GetAI()

UnitAI * Unit::GetAI ( )
inline
664{ return i_AI; }

References i_AI.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), spell_algalon_big_bang::CheckTargets(), DealDamage(), DealHeal(), spell_send_mug_target_picker::FilterTargets(), spell_blood_queen_bloodbolt::FilterTargets(), npc_dream_fog::npc_dream_fogAI::GetRandomUnitFromDragonThreatList(), BattlegroundIC::HandleCapturedNodes(), spell_send_mug_target_picker::HandleDummy(), spell_magtheridon_shadow_grasp_visual::HandleDummyApply(), spell_mount_check_aura::HandleEffectPeriodic(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_random_aggro::HandleOnHit(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_ayamiss_swarmer_start_loop::HandleScript(), spell_pursue::HandleScript(), spell_xt002_gravity_bomb_damage::HandleScript(), spell_the_lich_king_quake::HandleSendEvent(), npc_risen_guardian::npc_risen_guardianAI::IsSummonedBy(), npc_risen_guardian::npc_risen_guardianAI::KilledUnit(), ModifyPower(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), achievement_respect_your_elders::OnCheck(), achievement_hadronox_denied::OnCheck(), achievement_watch_him_die::OnCheck(), achievement_better_off_dred::OnCheck(), achievement_oh_novos::OnCheck(), achievement_share_the_love::OnCheck(), achievement_snakes_whyd_it_have_to_be_snakes::OnCheck(), achievement_im_on_a_boat::OnCheck(), achievement_all_you_can_eat::OnCheck(), achievement_been_waiting_long_time::OnCheck(), achievement_neck_deep_in_vile::OnCheck(), achievement_portal_jockey::OnCheck(), achievement_chaos_theory::OnCheck(), achievement_split_personality::OnCheck(), achievement_algalon_he_feeds_on_your_tears::OnCheck(), achievement_algalon_herald_of_the_titans::OnCheck(), achievement_flame_leviathan_towers::OnCheck(), achievement_flame_leviathan_shutout::OnCheck(), achievement_freya_getting_back_to_nature::OnCheck(), achievement_freya_knock_on_wood::OnCheck(), achievement_yogg_saron_drive_me_crazy::OnCheck(), achievement_yogg_saron_kiss_and_make_up::OnCheck(), achievement_intense_cold::OnCheck(), achievement_once_bitten_twice_shy::OnCheck(), spell_xt002_gravity_bomb_aura::OnPeriodic(), spell_marrowgar_coldflame::SelectTarget(), and boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::SpellHit().

◆ GetAllMinionsByEntry()

void Unit::GetAllMinionsByEntry ( std::list< Creature * > &  Minions,
uint32  entry 
)
10875{
10876 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10877 {
10878 Unit* unit = *itr;
10879 ++itr;
10880 if (unit->GetEntry() == entry && unit->IsCreature()
10881 && unit->ToCreature()->IsSummon()) // minion, actually
10882 Minions.push_back(unit->ToCreature());
10883 }
10884}
bool IsSummon() const
Definition Unit.h:757

References Object::GetEntry(), Object::IsCreature(), IsSummon(), m_Controlled, and Object::ToCreature().

Referenced by spell_item_gift_of_the_harvester::CheckRequirement().

◆ GetAPMultiplier()

float Unit::GetAPMultiplier ( WeaponAttackType  attType,
bool  normalized 
)
17242{
17243 if (!normalized || !IsPlayer())
17244 return float(GetAttackTime(attType)) / 1000.0f;
17245
17246 Item* Weapon = ToPlayer()->GetWeaponForAttack(attType, true);
17247 if (!Weapon)
17248 return 2.4f; // fist attack
17249
17250 switch (Weapon->GetTemplate()->InventoryType)
17251 {
17252 case INVTYPE_2HWEAPON:
17253 return 3.3f;
17254 case INVTYPE_RANGED:
17256 case INVTYPE_THROWN:
17257 return 2.8f;
17258 case INVTYPE_WEAPON:
17261 default:
17262 return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
17263 }
17264}
@ ITEM_SUBCLASS_WEAPON_DAGGER
Definition ItemTemplate.h:359
@ INVTYPE_RANGED
Definition ItemTemplate.h:271
@ INVTYPE_THROWN
Definition ItemTemplate.h:281
@ INVTYPE_RANGEDRIGHT
Definition ItemTemplate.h:282
@ INVTYPE_WEAPON
Definition ItemTemplate.h:269
@ INVTYPE_WEAPONMAINHAND
Definition ItemTemplate.h:277
@ INVTYPE_WEAPONOFFHAND
Definition ItemTemplate.h:278
@ INVTYPE_2HWEAPON
Definition ItemTemplate.h:273
Weapon
Definition boss_arlokk.cpp:76
Definition Item.h:220
ItemTemplate const * GetTemplate() const
Definition Item.cpp:544
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition PlayerStorage.cpp:488
uint32 SubClass
Definition ItemTemplate.h:622

References GetAttackTime(), Item::GetTemplate(), Player::GetWeaponForAttack(), INVTYPE_2HWEAPON, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_THROWN, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, Object::IsPlayer(), ITEM_SUBCLASS_WEAPON_DAGGER, ItemTemplate::SubClass, and Object::ToPlayer().

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and MeleeDamageBonusDone().

◆ GetAppliedAuras() [1/2]

◆ GetAppliedAuras() [2/2]

AuraApplicationMap const & Unit::GetAppliedAuras ( ) const
inline
1311{ return m_appliedAuras; }

References m_appliedAuras.

◆ GetArmor()

◆ getAttackerForHelper()

Unit * Unit::getAttackerForHelper ( ) const
741{
742 if (GetVictim() != nullptr)
743 return GetVictim();
744
745 if (!IsEngaged())
746 return nullptr;
747
748 if (!m_attackers.empty())
749 return *(m_attackers.begin());
750
751 return nullptr;
752}
bool IsEngaged() const
Definition Unit.h:887
Unit * GetVictim() const
Definition Unit.h:859

References GetVictim(), IsEngaged(), and m_attackers.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), PetAI::SelectNextTarget(), Creature::SelectVictim(), SetControlled(), TotemAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), and PetAI::UpdateAI().

◆ getAttackers()

◆ GetAttackTime()

◆ getAttackTimer()

◆ GetAura()

Aura * Unit::GetAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5582{
5583 AuraApplication* aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
5584 return aurApp ? aurApp->GetBase() : nullptr;
5585}
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5562

References GetAuraApplication(), and AuraApplication::GetBase().

Referenced by Player::_addSpell(), Pet::addSpell(), spell_mage_burning_determination::CheckProc(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_freya::boss_freyaAI::DoAction(), Spell::DoTriggersOnSpellHit(), Spell::EffectScriptEffect(), Spell::EffectTitanGrip(), Spell::EffectWeaponDmg(), getOrphanGUID(), spell_dk_scourge_strike::HandleAfterHit(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleAuraStacksCommand(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_charge_shield_bomber::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), HandleDummyAuraProc(), spell_yogg_saron_sanity_well_aura::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_sindragosa_frost_breath::HandleInfusion(), spell_dk_blood_caked_blade::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_unstable_experiment::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_pal_seal_of_vengeance::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), npc_gunship::npc_gunshipAI::JustDied(), boss_high_nethermancer_zerevor::JustEngagedWith(), npc_brew_bubble::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), spell_summoning_rhyme_aura::PeriodicTick(), Player::ProcessDelayedOperations(), BattlefieldWG::PromotePlayer(), RemoveAurasDueToSpellBySteal(), Player::ResurrectPlayer(), SetAuraStack(), boss_anomalus::SetData(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_pilgrims_bounty_chair::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_sindragosa::boss_sindragosaAI::SpellHitTarget(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::SpellHitTarget(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::SpellHitTarget(), npc_twilight_summon::npc_twilight_summonAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ GetAuraApplication()

AuraApplication * Unit::GetAuraApplication ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5563{
5564 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5565 for (; range.first != range.second; ++range.first)
5566 {
5567 AuraApplication* app = range.first->second;
5568 Aura const* aura = app->GetBase();
5569
5570 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5571 && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5572 && (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID)
5573 && (!except || except != app))
5574 {
5575 return app;
5576 }
5577 }
5578 return nullptr;
5579}
uint8 GetEffectMask() const
Definition SpellAuras.h:176
ObjectGuid GetCastItemGUID() const
Definition SpellAuras.h:103
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition Unit.h:646

References AuraApplication::GetBase(), Aura::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetEffectMask(), and m_appliedAuras.

Referenced by AuraApplication::_Remove(), GetAura(), GetAuraApplicationOfRankedSpell(), HasAura(), and Spell::UpdateChanneledTargetList().

◆ GetAuraApplicationOfRankedSpell()

AuraApplication * Unit::GetAuraApplicationOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5588{
5589 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5590 while (rankSpell)
5591 {
5592 if (AuraApplication* aurApp = GetAuraApplication(rankSpell, casterGUID, itemCasterGUID, reqEffMask, except))
5593 return aurApp;
5594 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5595 }
5596 return nullptr;
5597}

References GetAuraApplication(), and sSpellMgr.

Referenced by spell_warl_drain_soul::CheckProc(), and GetAuraOfRankedSpell().

◆ GetAuraCount()

uint32 Unit::GetAuraCount ( uint32  spellId) const
5683{
5684 uint32 count = 0;
5685 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5686
5687 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5688 {
5689 if (itr->second->GetBase()->GetStackAmount() == 0)
5690 ++count;
5691 else
5692 count += (uint32)itr->second->GetBase()->GetStackAmount();
5693 }
5694
5695 return count;
5696}

References m_appliedAuras.

Referenced by npc_brew_bubble::MoveInLineOfSight(), spell_valithria_suppression_aura::OnApply(), achievement_consumption_junction::OnCheck(), achievement_assembly_of_iron::OnCheck(), achievement_cant_do_that_while_stunned::OnCheck(), spell_valithria_suppression_aura::OnRemove(), SmartScript::ProcessEvent(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), spell_black_temple_spell_absorption_aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ GetAuraEffect() [1/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5535{
5536 AuraEffectList const& auras = GetAuraEffectsByType(type);
5537 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5538 {
5539 SpellInfo const* spell = (*i)->GetSpellInfo();
5540 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5541 {
5542 if (casterGUID && (*i)->GetCasterGUID() != casterGUID)
5543 continue;
5544 return (*i);
5545 }
5546 }
5547 return nullptr;
5548}
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
uint32 SpellFamilyName
Definition SpellInfo.h:387
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:468

References GetAuraEffectsByType(), flag96::HasFlag(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

◆ GetAuraEffect() [2/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  name,
uint32  iconId,
uint8  effIndex 
) const
5521{
5522 AuraEffectList const& auras = GetAuraEffectsByType(type);
5523 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5524 {
5525 if (effIndex != (*itr)->GetEffIndex())
5526 continue;
5527 SpellInfo const* spell = (*itr)->GetSpellInfo();
5528 if (spell->SpellIconID == iconId && spell->SpellFamilyName == name)
5529 return *itr;
5530 }
5531 return nullptr;
5532}
uint32 SpellIconID
Definition SpellInfo.h:380

References GetAuraEffectsByType(), SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

◆ GetAuraEffect() [3/3]

AuraEffect * Unit::GetAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5495{
5496 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5497 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5498 {
5499 if (itr->second->HasEffect(effIndex)
5500 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5501 {
5502 return itr->second->GetBase()->GetEffect(effIndex);
5503 }
5504 }
5505 return nullptr;
5506}

References AuraEffect::GetBase(), Aura::GetEffect(), and m_appliedAuras.

Referenced by CalculateSpellAmount(), Spell::CanAutoCast(), spell_mage_ice_barrier::CheckCast(), spell_pri_power_word_shield::CheckCast(), spell_mage_molten_armor::CheckProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectWeaponDmg(), GetAuraEffectOfRankedSpell(), GetDummyAuraEffect(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_dk_raise_ally::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), spell_warl_life_tap::HandleDummy(), HandleDummyAuraProc(), spell_warr_execute::HandleEffect(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pri_divine_aegis::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleShapeshiftBoosts(), spell_warl_drain_soul::HandleTick(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), Guardian::InitStatsForLevel(), npc_anzu_spirit::IsSummonedBy(), MeleeDamageBonusDone(), ModSpellDuration(), spell_dk_death_and_decay::RecalculateDamage(), RemoveAurasDueToSpellByDispel(), SpellDamageBonusDone(), SpellHealingBonusTaken(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), and npc_hallows_end_train_fire::UpdateAI().

◆ GetAuraEffectDummy()

AuraEffect * Unit::GetAuraEffectDummy ( uint32  spellid) const
5551{
5553 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5554 {
5555 if ((*itr)->GetId() == spellid)
5556 return *itr;
5557 }
5558
5559 return nullptr;
5560}
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67

References GetAuraEffectsByType(), and SPELL_AURA_DUMMY.

Referenced by Spell::EffectWeaponDmg(), Aura::HandleAuraSpecificMods(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), Guardian::InitStatsForLevel(), Kill(), spell_dk_death_and_decay::RecalculateDamage(), Player::RemoveSpellMods(), and SpellHealingBonusTaken().

◆ GetAuraEffectOfRankedSpell()

AuraEffect * Unit::GetAuraEffectOfRankedSpell ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5509{
5510 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5511 while (rankSpell)
5512 {
5513 if (AuraEffect* aurEff = GetAuraEffect(rankSpell, effIndex, caster))
5514 return aurEff;
5515 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5516 }
5517 return nullptr;
5518}
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5494

References GetAuraEffect(), and sSpellMgr.

Referenced by spell_mage_fire_frost_ward::Absorb(), spell_sha_earthbind_totem::Apply(), spell_sha_earthliving_weapon::CheckProc(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), SpellPctDamageModsDone(), and spell_mage_incanters_absorbtion_base_AuraScript::Trigger().

◆ GetAuraEffectsByType()

AuraEffectList const & Unit::GetAuraEffectsByType ( AuraType  type) const
inline
1355{ return m_modAuras[type]; }

References m_modAuras.

Referenced by Player::_ApplyWeaponDependentAuraMods(), Spell::_cast(), AuraApplication::_HandleEffect(), KillRewarder::_RewardXP(), CalcAbsorbResist(), CalcArmorReducedDamage(), CalcHealAbsorb(), AuraEffect::CalculateAmount(), Player::CalculateQuestRewardXP(), Spell::CheckCast(), Spell::CheckCasterAuras(), DealDamage(), DealMeleeDamage(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), RedirectSpellEvent::Execute(), spell_dk_wandering_plague::FilterTargets(), GetAuraEffect(), GetAuraEffect(), GetAuraEffectDummy(), GetDoTsByCaster(), GetMagicHitRedirectTarget(), GetMaxNegativeAuraModifier(), GetMaxNegativeAuraModifierByAffectMask(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifier(), GetMaxPositiveAuraModifierByAffectMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscValue(), Player::getMaxTimer(), GetMeleeHitRedirectTarget(), GetPhaseByAuras(), Player::GetResurrectionSpellId(), Player::GetRuneBaseCooldown(), GetTotalAuraModifier(), GetTotalAuraModifierAreaExclusive(), GetTotalAuraModifierByAffectMask(), GetTotalAuraModifierByMiscMask(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByAffectMask(), GetTotalAuraMultiplierByMiscMask(), GetTotalAuraMultiplierByMiscValue(), GetUnitCriticalChance(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleAuraTransform(), AuraEffect::HandleDetectAmore(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), HandleDummyAuraProc(), Spell::HandleLaunchPhase(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), modify_commandscript::HandleMorphMountCommand(), AuraEffect::HandleNoReagentUseAura(), spell_illidari_council_judgement::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), HasAuraState(), HasAuraTypeWithAffectMask(), HasAuraTypeWithCaster(), HasAuraTypeWithFamilyFlags(), HasAuraTypeWithMiscvalue(), HasAuraTypeWithTriggerSpell(), HasAuraTypeWithValue(), HasBreakableByDamageAuraType(), HasVisibleAuraType(), IsImmunedToSpellEffect(), IsScriptOverriden(), SpellInfo::IsStrongerAuraActive(), Player::isTotalImmune(), list_commandscript::ListAurasCommand(), MeleeDamageBonusDone(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Spell::PrepareTriggersExecutedOnHit(), processDummyAuras(), spell_dru_enrage::RecalculateBaseArmor(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::Respawn(), RestoreDisplayId(), Spell::SelectImplicitAreaTargets(), Spell::SelectImplicitConeTargets(), PetAI::SelectNextTarget(), Creature::SelectVictim(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), Player::SetEntryPoint(), Player::SetSkill(), SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SpellBaseHealingBonusDone(), SpellBaseHealingBonusTaken(), SpellDamageBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), SpellHealingBonusTaken(), SpellHitResult(), SpellHitResult(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), Player::SummonPet(), Player::TeleportTo(), SimpleCharmedAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), Player::UpdateArmor(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCharmedAI(), Player::UpdateExpertise(), Player::UpdateManaRegen(), Player::UpdateRating(), Player::UpdateResistances(), UpdateSpeed(), and Player::UpdateStats().

◆ GetAuraOfRankedSpell()

Aura * Unit::GetAuraOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5600{
5601 AuraApplication* aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
5602 return aurApp ? aurApp->GetBase() : nullptr;
5603}
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5587

References GetAuraApplicationOfRankedSpell(), and AuraApplication::GetBase().

Referenced by Aura::HandleAuraSpecificMods().

◆ GetCastingTimeForBonus()

uint32 Unit::GetCastingTimeForBonus ( SpellInfo const *  spellProto,
DamageEffectType  damagetype,
uint32  CastingTime 
) const
17102{
17103 // Not apply this to creature casted spells with casttime == 0
17104 if (CastingTime == 0 && IsCreature() && !IsPet())
17105 return 3500;
17106
17107 if (CastingTime > 7000) CastingTime = 7000;
17108 if (CastingTime < 1500) CastingTime = 1500;
17109
17110 if (damagetype == DOT && !spellProto->IsChanneled())
17111 CastingTime = 3500;
17112
17113 int32 overTime = 0;
17114 uint8 effects = 0;
17115 bool DirectDamage = false;
17116 bool AreaEffect = false;
17117
17118 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
17119 {
17120 switch (spellProto->Effects[i].Effect)
17121 {
17127 case SPELL_EFFECT_HEAL:
17128 DirectDamage = true;
17129 break;
17131 switch (spellProto->Effects[i].ApplyAuraName)
17132 {
17136 if (spellProto->GetDuration())
17137 overTime = spellProto->GetDuration();
17138 break;
17139 default:
17140 // -5% per additional effect
17141 ++effects;
17142 break;
17143 }
17144 default:
17145 break;
17146 }
17147
17148 if (spellProto->Effects[i].IsTargetingArea())
17149 AreaEffect = true;
17150 }
17151
17152 // Combined Spells with Both Over Time and Direct Damage
17153 if (overTime > 0 && DirectDamage)
17154 {
17155 // mainly for DoTs which are 3500 here otherwise
17156 uint32 OriginalCastTime = spellProto->CalcCastTime();
17157 if (OriginalCastTime > 7000) OriginalCastTime = 7000;
17158 if (OriginalCastTime < 1500) OriginalCastTime = 1500;
17159 // Portion to Over Time
17160 float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f));
17161
17162 if (damagetype == DOT)
17163 CastingTime = uint32(CastingTime * PtOT);
17164 else if (PtOT < 1.0f)
17165 CastingTime = uint32(CastingTime * (1 - PtOT));
17166 else
17167 CastingTime = 0;
17168 }
17169
17170 // Area Effect Spells receive only half of bonus
17171 if (AreaEffect)
17172 CastingTime /= 2;
17173
17174 // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
17175 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
17176 {
17177 if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
17178 (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
17179 {
17180 CastingTime /= 2;
17181 break;
17182 }
17183 }
17184
17185 // -5% of total per any additional effect
17186 for (uint8 i = 0; i < effects; ++i)
17187 CastingTime *= 0.95f;
17188
17189 return CastingTime;
17190}
@ SPELL_EFFECT_POWER_BURN
Definition SharedDefines.h:840
@ SPELL_EFFECT_HEALTH_LEECH
Definition SharedDefines.h:787
@ SPELL_EFFECT_HEAL
Definition SharedDefines.h:788
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition SharedDefines.h:785
@ SPELL_EFFECT_POWER_DRAIN
Definition SharedDefines.h:786
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition SharedDefines.h:780
@ SPELL_EFFECT_APPLY_AURA
Definition SharedDefines.h:784
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_LEECH
Definition SpellAuraDefines.h:116

References SpellInfo::CalcCastTime(), DOT, SpellInfo::Effects, SpellInfo::GetDuration(), SpellInfo::IsChanneled(), Object::IsCreature(), IsPet(), MAX_SPELL_EFFECTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_POWER_BURN, SPELL_EFFECT_POWER_DRAIN, and SPELL_EFFECT_SCHOOL_DAMAGE.

Referenced by CalculateDefaultCoefficient().

◆ GetCharm()

Unit * Unit::GetCharm ( ) const
10695{
10696 if (ObjectGuid charm_guid = GetCharmGUID())
10697 {
10698 if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
10699 return pet;
10700
10701 LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature {} not exist.", charm_guid.ToString());
10703 }
10704
10705 return nullptr;
10706}
@ UNIT_FIELD_CHARM
Definition UpdateFields.h:86
void SetGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:723
ObjectGuid GetCharmGUID() const
Definition Unit.h:692
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition ObjectAccessor.cpp:199

References ObjectGuid::Empty, GetCharmGUID(), ObjectAccessor::GetUnit(), LOG_ERROR, Object::SetGuidValue(), and UNIT_FIELD_CHARM.

Referenced by Spell::_cast(), AddPetAura(), spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Dismount(), Spell::finish(), GetFirstControlled(), spell_warl_eye_of_kilrogg::HandleAuraApply(), spell_warl_eye_of_kilrogg::HandleAuraRemove(), spell_dk_raise_ally::HandleDummy(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), WorldSession::HandleRequestPetInfo(), isPossessing(), Mount(), Player::PossessSpellInitialize(), RemovePetAura(), Spell::SelectImplicitCasterObjectTargets(), SetSpeed(), npc_pilgrims_bounty_chair::SpellHitTarget(), and Player::StopCastingCharm().

◆ GetCharmer()

◆ GetCharmerGUID()

◆ GetCharmerOrOwner()

◆ GetCharmerOrOwnerGUID()

◆ GetCharmerOrOwnerOrOwnGUID()

◆ GetCharmerOrOwnerOrSelf()

Unit * Unit::GetCharmerOrOwnerOrSelf ( ) const
inline
1219 {
1220 if (Unit* u = GetCharmerOrOwner())
1221 return u;
1222
1223 return (Unit*)this;
1224 }

References GetCharmerOrOwner().

Referenced by CombatStart(), CombatStartOnCast(), GetPartyMembers(), GetReactionTo(), IsInPartyWith(), IsInRaidWith(), SetInCombatWith(), and TotemAI::UpdateAI().

◆ GetCharmerOrOwnerPlayerOrPlayerItself()

Player * Unit::GetCharmerOrOwnerPlayerOrPlayerItself ( ) const
10640{
10642 if (guid.IsPlayer())
10643 return ObjectAccessor::GetPlayer(*this, guid);
10644
10645 return const_cast<Unit*>(this)->ToPlayer();
10646}
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition ObjectAccessor.cpp:220

References GetCharmerOrOwnerGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), and Object::ToPlayer().

Referenced by Spell::_handle_finish_phase(), spell_sha_earthbind_totem::Apply(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), BuildValuesUpdate(), spell_q12237_rescue_villager::CheckCast(), spell_q12237_drop_off_villager::CheckCast(), CombatStart(), CombatStartOnCast(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), DealDamage(), Spell::EffectGameObjectSetDestructionState(), Spell::EffectKillCredit(), Spell::EffectKillCreditPersonal(), Spell::EffectSummonPet(), GetAffectingPlayer(), Object::GetUpdateFieldData(), spell_gen_charmed_unit_spell_cooldown::HandleCast(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_q12851_going_bearback::HandleEffectApply(), spell_q12726_song_of_wind_and_water::HandleHealPct(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_q10769_dissension_amongst_the_ranks::HandleScriptEffect(), npc_pet_gen_valkyr_guardian::InitializeAI(), isTargetableForAttack(), GuardAI::JustDied(), boss_kurinnaxx::JustDied(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), npc_four_car_garage::npc_four_car_garageAI::JustDied(), npc_scion_of_eternity::npc_scion_of_eternityAI::JustDied(), Kill(), Condition::Meets(), GameObject::ModifyHealth(), npc_amanishi_lookout::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), Pet::RemoveSpellCooldown(), Spell::SendSpellCooldown(), SetCharm(), SetContestedPvP(), SetInCombatState(), Creature::SetLootRecipient(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::SpellHit(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), and Creature::UpdateEntry().

◆ GetCharmGUID()

◆ GetCharmInfo()

◆ getClass()

uint8 Unit::getClass ( ) const
inline
806{ return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
@ UNIT_FIELD_BYTES_0
Definition UpdateFields.h:95
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition Object.cpp:323

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), ArenaTeam::AddMember(), SpellEffectInfo::CalcValue(), spell_class_call_handler::FilterTargets(), getClassMask(), GetDebugInfo(), Player::GetDodgeFromAgility(), SocialMgr::GetFriendInfo(), Player::GetMeleeCritFromAgility(), Player::GetMissPercentageFromDefence(), Player::GetPlayerName(), Player::GetRatingMultiplier(), Player::GetSpec(), Player::GetSpellCritFromIntellect(), Player::GetStartPosition(), Player::GiveLevel(), spell_item_flask_of_the_north::HandleDummy(), HandleDummyAuraProc(), learn_commandscript::HandleLearnAllMySpellsCommand(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), HandleProcTriggerSpell(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDataForForm(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Player::IsClass(), IsClass(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), ClassCallSelector::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), Player::RewardHonor(), Guild::Member::SetStats(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Player::StoreNewItemInBestSlots(), Player::UpdateDodgePercentage(), Player::UpdateParryPercentage(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getClassMask()

◆ GetCollisionHeight()

float Unit::GetCollisionHeight ( ) const
overridevirtual

Return collision height sent to client.

Reimplemented from WorldObject.

21130{
21131 float scaleMod = GetObjectScale(); // 99% sure about this
21132 float defaultHeight = DEFAULT_COLLISION_HEIGHT * scaleMod;
21133
21134 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
21135 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
21136 float collisionHeight = 0.0f;
21137
21138 if (IsMounted())
21139 {
21141 {
21142 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
21143 {
21144 collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f);
21145 }
21146 }
21147 }
21148 else
21149 collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale;
21150
21151 return collisionHeight == 0.0f ? defaultHeight : collisionHeight;
21152}
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
#define DEFAULT_COLLISION_HEIGHT
Definition ObjectDefines.h:50
float GetObjectScale() const
Definition Object.h:118
Definition DBCStructure.h:720
uint32 ModelId
Definition DBCStructure.h:722
float scale
Definition DBCStructure.h:725
Definition DBCStructure.h:774
float Scale
Definition DBCStructure.h:778
float CollisionHeight
Definition DBCStructure.h:789

References CreatureModelDataEntry::CollisionHeight, DEFAULT_COLLISION_HEIGHT, GetNativeDisplayId(), Object::GetObjectScale(), Object::GetUInt32Value(), IsMounted(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by DynObjAura::FillTargetMap(), WorldObject::GetNearPoint(), GetRandomContactPoint(), WorldSession::HandleMovementOpcodes(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Spell::SelectImplicitCasterDestTargets(), spell_spawn_blood_pool::SetDest(), WorldObject::UpdateAllowedPositionZ(), and Creature::UpdateMovementFlags().

◆ GetCollisionRadius()

float Unit::GetCollisionRadius ( ) const
overridevirtual

this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the radius also takes in consideration the mount size

Returns
float The radius of a unit

Reimplemented from WorldObject.

21124{
21125 return GetCollisionWidth() / 2;
21126}
float GetCollisionWidth() const override
this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by...
Definition Unit.cpp:21086

References GetCollisionWidth().

Referenced by GetMeleeAttackPoint(), and Creature::Update().

◆ GetCollisionWidth()

float Unit::GetCollisionWidth ( ) const
overridevirtual

this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the diameter also takes in consideration the mount size

Returns
float The diameter of a unit

Dismounting case - use basic default model data

Reimplemented from WorldObject.

21087{
21088 if (IsPlayer())
21089 return GetObjectSize();
21090
21091 float scaleMod = GetObjectScale(); // 99% sure about this
21092 float objectSize = GetObjectSize();
21093 float defaultSize = DEFAULT_WORLD_OBJECT_SIZE * scaleMod;
21094
21096 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
21097 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
21098
21099 if (IsMounted())
21100 {
21102 {
21103 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
21104 {
21105 if (G3D::fuzzyGt(mountModelData->CollisionWidth, modelData->CollisionWidth))
21106 modelData = mountModelData;
21107 }
21108 }
21109 }
21110
21111 float collisionWidth = scaleMod * modelData->CollisionWidth * modelData->Scale * displayInfo->scale * 2;
21112 // if the objectSize is the default value or the creature is mounted and we have a DBC value, then we can retrieve DBC value instead
21113 return G3D::fuzzyGt(collisionWidth, 0.0f) && (G3D::fuzzyEq(objectSize,defaultSize) || IsMounted()) ? collisionWidth : objectSize;
21114}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition ObjectDefines.h:45
float GetObjectSize() const
Definition Object.cpp:2784
float CollisionWidth
Definition DBCStructure.h:788

References CreatureModelDataEntry::CollisionWidth, DEFAULT_WORLD_OBJECT_SIZE, GetNativeDisplayId(), Object::GetObjectScale(), WorldObject::GetObjectSize(), Object::GetUInt32Value(), IsMounted(), Object::IsPlayer(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by GetCollisionRadius().

◆ GetCombatRatingDamageReduction()

uint32 Unit::GetCombatRatingDamageReduction ( CombatRating  cr,
float  rate,
float  cap,
uint32  damage 
) const
private
19218{
19219 float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
19220 return CalculatePct(damage, percent);
19221}
float GetCombatRatingReduction(CombatRating cr) const
Definition Unit.cpp:19205

References CalculatePct(), and GetCombatRatingReduction().

Referenced by GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritDamageReduction(), and GetSpellDamageReduction().

◆ GetCombatRatingReduction()

float Unit::GetCombatRatingReduction ( CombatRating  cr) const
private
19206{
19207 if (Player const* player = ToPlayer())
19208 return player->GetRatingBonusValue(cr);
19209 // Player's pet get resilience from owner
19210 else if (IsPet() && GetOwner())
19211 if (Player* owner = GetOwner()->ToPlayer())
19212 return owner->GetRatingBonusValue(cr);
19213
19214 return 0.0f;
19215}

References GetOwner(), IsPet(), and Object::ToPlayer().

Referenced by GetCombatRatingDamageReduction(), GetMeleeCritChanceReduction(), GetRangedCritChanceReduction(), and GetSpellCritChanceReduction().

◆ GetCombatReach()

◆ GetCombatTimer()

uint32 Unit::GetCombatTimer ( ) const
inline
900{ return m_CombatTimer; }

References m_CombatTimer.

Referenced by Spell::DoSpellHitOnUnit(), and SetInCombatState().

◆ GetComboPoints() [1/2]

uint8 Unit::GetComboPoints ( ObjectGuid const &  guid) const
inline
965{ return (m_comboTarget && m_comboTarget->GetGUID() == guid) ? m_comboPoints : 0; }

References Object::GetGUID(), m_comboPoints, and m_comboTarget.

◆ GetComboPoints() [2/2]

uint8 Unit::GetComboPoints ( Unit const *  who = nullptr) const
inline

◆ GetComboTarget()

Unit * Unit::GetComboTarget ( ) const
inline
966{ return m_comboTarget; }

References m_comboTarget.

Referenced by Player::DuelComplete(), and HandleProcTriggerSpell().

◆ GetComboTargetGUID()

ObjectGuid const Unit::GetComboTargetGUID ( ) const
inline

◆ GetCompanionPet()

Creature * Unit::GetCompanionPet ( ) const
10690{
10692}
#define SUMMON_SLOT_MINIPET
Definition Unit.h:605
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition ObjectAccessor.cpp:210

References ObjectAccessor::GetCreature(), m_SummonSlot, and SUMMON_SLOT_MINIPET.

Referenced by HandleProcTriggerSpell().

◆ GetCreateHealth()

◆ GetCreateMana()

◆ GetCreatePowers()

uint32 Unit::GetCreatePowers ( Powers  power) const
15684{
15685 // Only hunter pets have POWER_FOCUS and POWER_HAPPINESS
15686 switch (power)
15687 {
15688 case POWER_MANA:
15689 return GetCreateMana();
15690 case POWER_RAGE:
15691 return 1000;
15692 case POWER_FOCUS:
15693 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
15694 case POWER_ENERGY:
15695 return 100;
15696 case POWER_HAPPINESS:
15697 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
15698 case POWER_RUNIC_POWER:
15699 return 1000;
15700 case POWER_RUNE:
15701 return 0;
15702 case POWER_HEALTH:
15703 return 0;
15704 default:
15705 break;
15706 }
15707
15708 return 0;
15709}
@ POWER_HEALTH
Definition SharedDefines.h:278
@ POWER_RUNIC_POWER
Definition SharedDefines.h:275
@ POWER_ENERGY
Definition SharedDefines.h:272
@ POWER_RUNE
Definition SharedDefines.h:274
@ POWER_FOCUS
Definition SharedDefines.h:271
uint32 GetCreateMana() const
Definition Unit.h:1076

References GetCreateMana(), HUNTER_PET, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, and POWER_RUNIC_POWER.

Referenced by Pet::CreateBaseAtTamed(), HandleDummyAuraProc(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), setPowerType(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ GetCreateStat()

float Unit::GetCreateStat ( Stats  stat) const
inline

◆ GetCreatorGUID()

ObjectGuid Unit::GetCreatorGUID ( ) const
inline
@ UNIT_FIELD_CREATEDBY
Definition UpdateFields.h:91

References Object::GetGuidValue(), and UNIT_FIELD_CREATEDBY.

Referenced by Condition::Meets().

◆ GetCreatureType()

uint32 Unit::GetCreatureType ( ) const
15206{
15207 if (IsPlayer())
15208 {
15210 SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form);
15211 if (ssEntry && ssEntry->creatureType > 0)
15212 return ssEntry->creatureType;
15213 else
15215 }
15216 else
15217 return ToCreature()->GetCreatureTemplate()->type;
15218}
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
@ CREATURE_TYPE_HUMANOID
Definition SharedDefines.h:2634
ShapeshiftForm
Definition UnitDefines.h:68
ShapeshiftForm GetShapeshiftForm() const
Definition Unit.h:1867
uint32 type
Definition CreatureData.h:222
Definition DBCStructure.h:1816
int32 creatureType
Definition DBCStructure.h:1822

References CREATURE_TYPE_HUMANOID, SpellShapeshiftFormEntry::creatureType, Creature::GetCreatureTemplate(), GetShapeshiftForm(), Object::IsPlayer(), sSpellShapeshiftFormStore, Object::ToCreature(), and CreatureTemplate::type.

Referenced by Creature::CanStartAttack(), spell_utgarde_pinnacle_beast_mark::CheckProc(), Spell::EffectKnockBack(), GetCreatureTypeMask(), GetUnitParryChance(), AuraEffect::HandleAuraEmpathy(), spell_dru_starfall_dummy::HandleDummy(), IsCritter(), CreatureAI::MoveInLineOfSight(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), SetInCombatState(), and Creature::UpdateMoveInLineOfSightState().

◆ GetCreatureTypeMask()

uint32 Unit::GetCreatureTypeMask ( ) const
inline
792 {
793 uint32 creatureType = GetCreatureType();
794 return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
795 }
uint32 GetCreatureType() const
Definition Unit.cpp:15205

References GetCreatureType().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), SpellInfo::CheckTargetCreatureType(), MeleeDamageBonusDone(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ GetCritterGUID()

ObjectGuid Unit::GetCritterGUID ( ) const
inline

◆ GetCurrentSpell() [1/2]

◆ GetCurrentSpell() [2/2]

Spell * Unit::GetCurrentSpell ( uint32  spellType) const
inline
1500{ return m_currentSpells[spellType]; }

References m_currentSpells.

◆ GetCurrentSpellCastTime()

int32 Unit::GetCurrentSpellCastTime ( uint32  spell_id) const
4153{
4154 if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
4155 return spell->GetCastTime();
4156 return 0;
4157}
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:4144

References FindCurrentSpellBySpellId(), and Spell::GetCastTime().

Referenced by CasterAI::JustEngagedWith(), CasterAI::UpdateAI(), and boss_mandokir::boss_mandokirAI::UpdateAI().

◆ getDeathState()

◆ GetDebugInfo()

std::string Unit::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

21354{
21355 std::stringstream sstr;
21356 sstr << WorldObject::GetDebugInfo() << "\n"
21357 << std::boolalpha
21358 << "AliveState: " << IsAlive()
21359 << " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
21360 << " Class: " << std::to_string(getClass());
21361 return sstr.str();
21362}
std::string GetDebugInfo() const override
Definition Object.cpp:2497

References getClass(), WorldObject::GetDebugInfo(), GetExtraUnitMovementFlags(), GetUnitMovementFlags(), and IsAlive().

Referenced by UnitAI::GetDebugInfo(), Creature::GetDebugInfo(), and Player::GetDebugInfo().

◆ GetDefaultMovementType()

MovementGeneratorType Unit::GetDefaultMovementType ( ) const
virtual

-------—End of Pet responses methods-------—

Reimplemented in Creature.

16669{
16670 return IDLE_MOTION_TYPE;
16671}
@ IDLE_MOTION_TYPE
Definition MotionMaster.h:39

References IDLE_MOTION_TYPE.

◆ GetDefenseSkillValue()

uint32 Unit::GetDefenseSkillValue ( Unit const *  target = nullptr) const
3626{
3627 if (IsPlayer())
3628 {
3629 // in PvP use full skill instead current skill value
3630 uint32 value = (target && target->IsPlayer())
3633 value += uint32(ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
3634 return value;
3635 }
3636 else
3637 return GetUnitMeleeSkill(target);
3638}
@ SKILL_DEFENSE
Definition SharedDefines.h:2881
@ CR_DEFENSE_SKILL
Definition Unit.h:218
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5468
uint16 GetMaxSkillValue(uint32 skill) const
Definition Player.cpp:5485

References CR_DEFENSE_SKILL, Player::GetMaxSkillValue(), Player::GetSkillValue(), GetUnitMeleeSkill(), Object::IsPlayer(), SKILL_DEFENSE, and Object::ToPlayer().

Referenced by spell_pal_ardent_defender::Absorb(), DealMeleeDamage(), GetUnitCriticalChance(), RollMeleeOutcomeAgainst(), SpellTakenCritChance(), Player::UpdateBlockPercentage(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetDiminishing()

DiminishingLevels Unit::GetDiminishing ( DiminishingGroup  group)
15031{
15032 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
15033 {
15034 if (i->DRGroup != group)
15035 continue;
15036
15037 if (!i->hitCount)
15038 return DIMINISHING_LEVEL_1;
15039
15040 if (!i->hitTime)
15041 return DIMINISHING_LEVEL_1;
15042
15043 // If last spell was casted more than 15 seconds ago - reset the count.
15044 if (i->stack == 0 && getMSTimeDiff(i->hitTime, GameTime::GetGameTimeMS().count()) > 15000)
15045 {
15046 i->hitCount = DIMINISHING_LEVEL_1;
15047 return DIMINISHING_LEVEL_1;
15048 }
15049 // or else increase the count.
15050 else
15051 return DiminishingLevels(i->hitCount);
15052 }
15053 return DIMINISHING_LEVEL_1;
15054}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition Timer.h:110

References DIMINISHING_LEVEL_1, GameTime::GetGameTimeMS(), getMSTimeDiff(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ GetDirectTransport()

TransportBase * Unit::GetDirectTransport ( ) const

◆ GetDiseasesByCaster()

uint32 Unit::GetDiseasesByCaster ( ObjectGuid  casterGUID,
uint8  mode = 0 
)
5845{
5846 static const AuraType diseaseAuraTypes[] =
5847 {
5848 SPELL_AURA_PERIODIC_DAMAGE, // Frost Fever and Blood Plague
5849 SPELL_AURA_LINKED, // Crypt Fever and Ebon Plague
5851 };
5852
5853 ObjectGuid drwGUID;
5854
5855 if (Player* playerCaster = ObjectAccessor::GetPlayer(*this, casterGUID))
5856 drwGUID = playerCaster->getRuneWeaponGUID();
5857
5858 uint32 diseases = 0;
5859 for (uint8 index = 0; diseaseAuraTypes[index] != SPELL_AURA_NONE; ++index)
5860 {
5861 for (AuraEffectList::iterator i = m_modAuras[diseaseAuraTypes[index]].begin(); i != m_modAuras[diseaseAuraTypes[index]].end();)
5862 {
5863 // Get auras with disease dispel type by caster
5864 if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE
5865 && ((*i)->GetCasterGUID() == casterGUID || (*i)->GetCasterGUID() == drwGUID)) // if its caster or his dancing rune weapon
5866 {
5867 ++diseases;
5868
5869 if (mode == 1)
5870 {
5871 RemoveAura((*i)->GetId(), (*i)->GetCasterGUID());
5872 i = m_modAuras[diseaseAuraTypes[index]].begin();
5873 continue;
5874 }
5875 // used for glyph of scourge strike
5876 else if (mode == 2)
5877 {
5878 Aura* aura = (*i)->GetBase();
5879 if (aura && !aura->IsRemoved() && aura->GetDuration() > 0)
5880 if ((aura->GetApplyTime() + aura->GetMaxDuration() / 1000 + 8) > (GameTime::GetGameTime().count() + aura->GetDuration() / 1000))
5881 aura->SetDuration(aura->GetDuration() + 3000);
5882 }
5883 }
5884 ++i;
5885 }
5886 }
5887 return diseases;
5888}
@ DISPEL_DISEASE
Definition SharedDefines.h:1375
AuraType
Definition SpellAuraDefines.h:62
@ SPELL_AURA_LINKED
Definition SpellAuraDefines.h:347
@ SPELL_AURA_NONE
Definition SpellAuraDefines.h:63
int32 GetMaxDuration() const
Definition SpellAuras.h:129
time_t GetApplyTime() const
Definition SpellAuras.h:128

References DISPEL_DISEASE, Aura::GetApplyTime(), Aura::GetDuration(), GameTime::GetGameTime(), Aura::GetMaxDuration(), ObjectAccessor::GetPlayer(), Aura::IsRemoved(), m_modAuras, RemoveAura(), Aura::SetDuration(), SPELL_AURA_LINKED, SPELL_AURA_NONE, and SPELL_AURA_PERIODIC_DAMAGE.

Referenced by Spell::EffectWeaponDmg(), MeleeDamageBonusDone(), and SpellPctDamageModsDone().

◆ GetDispellableAuraList()

void Unit::GetDispellableAuraList ( Unit caster,
uint32  dispelMask,
DispelChargesList dispelList,
SpellInfo const *  dispelSpell 
)
5606{
5607 // we should not be able to dispel diseases if the target is affected by unholy blight
5608 if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
5609 dispelMask &= ~(1 << DISPEL_DISEASE);
5610
5611 ReputationRank rank = GetReactionTo(caster, IsCharmed());
5612 bool positive = rank >= REP_FRIENDLY;
5613
5614 // Neutral unit not at war with caster should be treated as a friendly unit
5615 if (rank == REP_NEUTRAL)
5616 {
5617 if (Player* casterPlayer = caster->GetAffectingPlayer())
5618 {
5619 if (FactionTemplateEntry const* factionTemplateEntry = GetFactionTemplateEntry())
5620 {
5621 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
5622 {
5623 if (factionEntry->CanBeSetAtWar())
5624 {
5625 positive = !casterPlayer->GetReputationMgr().IsAtWar(factionEntry);
5626 }
5627 }
5628 }
5629 }
5630 }
5631
5632 Unit::VisibleAuraMap const* visibleAuras = GetVisibleAuras();
5633 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
5634 {
5635 Aura* aura = itr->second->GetBase();
5636
5637 // don't try to remove passive auras
5638 if (aura->IsPassive())
5639 continue;
5640
5641 if (aura->GetSpellInfo()->GetDispelMask() & dispelMask)
5642 {
5643 if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
5644 {
5645 // do not remove positive auras if friendly target
5646 // negative auras if non-friendly target
5647 if (itr->second->IsPositive() == positive)
5648 continue;
5649 }
5650
5651 // Banish should only be dispelled by Mass Dispel
5652 if (aura->GetSpellInfo()->Mechanic == MECHANIC_BANISH && !dispelSpell->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
5653 {
5654 continue;
5655 }
5656
5657 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
5658 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
5659 // Polymorph instead of 1 / (5 + 1) -> 16%.
5660 bool dispel_charges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
5661 uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
5662 if (charges > 0)
5663 dispelList.push_back(std::make_pair(aura, charges));
5664 }
5665 }
5666}
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
Definition SharedDefines.h:651
@ MECHANIC_BANISH
Definition SharedDefines.h:1343
@ SPELL_ATTR0_NO_IMMUNITIES
Definition SharedDefines.h:411
@ REP_FRIENDLY
Definition SharedDefines.h:184
@ DISPEL_MAGIC
Definition SharedDefines.h:1373
uint8 GetStackAmount() const
Definition SpellAuras.h:148
uint8 GetCharges() const
Definition SpellAuras.h:141
bool IsPassive() const
Definition SpellAuras.cpp:1082
uint32 Mechanic
Definition SpellInfo.h:323
uint32 Dispel
Definition SpellInfo.h:322
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5721
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition Unit.h:658
VisibleAuraMap const * GetVisibleAuras()
Definition Unit.h:1462

References SpellInfo::Dispel, DISPEL_DISEASE, DISPEL_MAGIC, GetAffectingPlayer(), Aura::GetCharges(), SpellInfo::GetDispelMask(), GetFactionTemplateEntry(), GetReactionTo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetVisibleAuras(), SpellInfo::HasAttribute(), HasAura(), IsCharmed(), Aura::IsPassive(), SpellInfo::Mechanic, MECHANIC_BANISH, REP_FRIENDLY, REP_NEUTRAL, sFactionStore, SPELL_ATTR0_NO_IMMUNITIES, and SPELL_ATTR7_DISPEL_REMOVES_CHARGES.

Referenced by Spell::CheckCast(), and Spell::EffectDispel().

◆ GetDisplayId()

◆ GetDisplayRace()

DisplayRace Unit::GetDisplayRace ( ) const
inline
DisplayRace GetDisplayRaceFromModelId(uint32 modelId) const
Definition Unit.cpp:21048
uint32 GetDisplayId() const
Definition Unit.h:1887

References GetDisplayId(), and GetDisplayRaceFromModelId().

Referenced by AuraEffect::HandleAuraTransform().

◆ GetDisplayRaceFromModelId()

DisplayRace Unit::GetDisplayRaceFromModelId ( uint32  modelId) const
21049{
21050 if (CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(modelId))
21051 {
21052 if (CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtendedDisplayInfoID))
21053 {
21054 return DisplayRace(displayExtra->DisplayRaceID);
21055 }
21056 }
21057 return DisplayRace::None;
21058}
DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt)
DisplayRace
Definition SharedDefines.h:111
Definition DBCStructure.h:738

References None, sCreatureDisplayInfoExtraStore, and sCreatureDisplayInfoStore.

Referenced by GetDisplayRace().

◆ GetDoTsByCaster()

uint32 Unit::GetDoTsByCaster ( ObjectGuid  casterGUID) const
5891{
5892 static const AuraType diseaseAuraTypes[] =
5893 {
5897 };
5898
5899 uint32 dots = 0;
5900 for (AuraType const* itr = &diseaseAuraTypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
5901 {
5902 Unit::AuraEffectList const& auras = GetAuraEffectsByType(*itr);
5903 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5904 {
5905 // Get auras by caster
5906 if ((*i)->GetCasterGUID() == casterGUID)
5907 ++dots;
5908 }
5909 }
5910 return dots;
5911}
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition SpellAuraDefines.h:152

References GetAuraEffectsByType(), SPELL_AURA_NONE, SPELL_AURA_PERIODIC_DAMAGE, and SPELL_AURA_PERIODIC_DAMAGE_PERCENT.

Referenced by SpellPctDamageModsDone().

◆ GetDummyAuraEffect()

◆ GetDynamicFlags()

◆ GetDynObject()

DynamicObject * Unit::GetDynObject ( uint32  spellId)
6152{
6153 if (m_dynObj.empty())
6154 return nullptr;
6155 for (DynObjectList::const_iterator i = m_dynObj.begin(); i != m_dynObj.end(); ++i)
6156 {
6157 DynamicObject* dynObj = *i;
6158 if (dynObj->GetSpellId() == spellId)
6159 return dynObj;
6160 }
6161 return nullptr;
6162}
Definition DynamicObject.h:35
uint32 GetSpellId() const
Definition DynamicObject.h:58

References DynamicObject::GetSpellId(), and m_dynObj.

Referenced by Spell::DelayedChannel(), WorldSession::HandleFarSightOpcode(), and boss_akilzon::JustEngagedWith().

◆ GetEffectiveResistChance()

float Unit::GetEffectiveResistChance ( Unit const *  owner,
SpellSchoolMask  schoolMask,
Unit const *  victim 
)
static
2114{
2115 float victimResistance = float(victim->GetResistance(schoolMask));
2116 if (owner)
2117 {
2118 // Xinef: pets inherit 100% of masters penetration
2119 // Xinef: excluding traps
2120 Player const* player = owner->GetSpellModOwner();
2121 if (player && owner->GetEntry() != WORLD_TRIGGER)
2122 {
2123 victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2124 victimResistance -= float(player->GetSpellPenetrationItemMod());
2125 }
2126 else
2127 victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2128 }
2129
2130 victimResistance = std::max(victimResistance, 0.0f);
2131 if (owner)
2132 victimResistance += std::max((float(victim->GetLevel()) - float(owner->GetLevel())) * 5.0f, 0.0f);
2133
2134 static uint32 const BOSS_LEVEL = 83;
2135 static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
2136 uint32 level = victim->GetLevel();
2137 float resistanceConstant = 0.0f;
2138
2139 if (level == BOSS_LEVEL)
2140 resistanceConstant = BOSS_RESISTANCE_CONSTANT;
2141 else
2142 resistanceConstant = level * 5.0f;
2143
2144 return victimResistance / (victimResistance + resistanceConstant);
2145}
int32 GetSpellPenetrationItemMod() const
Definition Player.h:1975

References Object::GetEntry(), GetLevel(), GetResistance(), GetSpellModOwner(), Player::GetSpellPenetrationItemMod(), GetTotalAuraModifierByMiscMask(), SPELL_AURA_MOD_TARGET_RESISTANCE, and WORLD_TRIGGER.

Referenced by CalcAbsorbResist(), and MagicSpellHitResult().

◆ GetExtraUnitMovementFlags()

uint16 Unit::GetExtraUnitMovementFlags ( ) const
inline

◆ GetFaction()

uint32 Unit::GetFaction ( ) const
inline

References Object::GetUInt32Value(), and UNIT_FIELD_FACTIONTEMPLATE.

Referenced by npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::AttackStart(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::AttackStart(), Creature::CanAssistTo(), spell_q10985_light_of_the_naaru::CheckProc(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), Spell::EffectDuel(), Spell::EffectSummonType(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::EnterEvadeMode(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::EnterEvadeMode(), npc_chesspiece::GetDefaultOrientationForTeam(), GetFactionTemplateEntry(), GetReactionTo(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleGossipHelloOpcode(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_echo_of_medivh::HandlePieceJustDied(), WorldSession::HandlePlayerLoginFromDB(), TempSummon::InitStats(), InitTamedPet(), IsFriendly(), IsInPartyWith(), IsInRaidWith(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), boss_shade_of_aran::JustEngagedWith(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), boss_volkhan::boss_volkhanAI::JustSummoned(), Pet::LoadPetFromDB(), npc_chesspiece::npc_chesspiece(), npc_plucky::npc_pluckyAI::npc_pluckyAI(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::npc_taskmaster_fizzuleAI(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), npc_eris_hevenfire::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), PatchValuesUpdate(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), WorldSession::SendAuctionHello(), SetCharmedBy(), Player::SetGameMaster(), npc_chesspiece::sGossipHello(), boss_malchezaar::SpawnInfernal(), Spell::SummonGuardian(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_chesspiece::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), and Creature::UpdateMoveInLineOfSightState().

◆ GetFactionReactionTo()

ReputationRank Unit::GetFactionReactionTo ( FactionTemplateEntry const *  factionTemplateEntry,
Unit const *  target 
) const
10208{
10209 // always neutral when no template entry found
10210 if (!factionTemplateEntry)
10211 return REP_NEUTRAL;
10212
10213 FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry();
10214 if (!targetFactionTemplateEntry)
10215 return REP_NEUTRAL;
10216
10217 // xinef: check forced reputation for self also
10218 if (Player const* selfPlayerOwner = GetAffectingPlayer())
10219 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(target->GetFactionTemplateEntry()))
10220 return *repRank;
10221
10222 if (Player const* targetPlayerOwner = target->GetAffectingPlayer())
10223 {
10224 // check contested flags
10225 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
10226 && targetPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
10227 return REP_HOSTILE;
10228 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
10229 return *repRank;
10230 if (!target->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
10231 {
10232 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
10233 {
10234 if (factionEntry->CanHaveReputation())
10235 {
10236 // CvP case - check reputation, don't allow state higher than neutral when at war
10237 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
10238 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
10239 repRank = std::min(REP_NEUTRAL, repRank);
10240 return repRank;
10241 }
10242 }
10243 }
10244 }
10245
10246 // common faction based check
10247 if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
10248 return REP_HOSTILE;
10249 if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
10250 return REP_FRIENDLY;
10251 if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
10252 return REP_FRIENDLY;
10253 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS)
10254 return REP_HOSTILE;
10255 // neutral by default
10256 return REP_NEUTRAL;
10257}
@ FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS
Definition DBCEnums.h:332
@ FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
Definition DBCEnums.h:331
@ PLAYER_FLAGS_CONTESTED_PVP
Definition Player.h:487
@ UNIT_FLAG2_IGNORE_REPUTATION
Definition UnitDefines.h:291
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition DBCStructure.h:950

References FactionTemplateEntry::faction, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS, FactionTemplateEntry::factionFlags, GetAffectingPlayer(), GetFactionTemplateEntry(), HasUnitFlag2(), FactionTemplateEntry::IsFriendlyTo(), FactionTemplateEntry::IsHostileTo(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HOSTILE, REP_NEUTRAL, sFactionStore, and UNIT_FLAG2_IGNORE_REPUTATION.

Referenced by GetReactionTo().

◆ GetFactionTemplateEntry()

FactionTemplateEntry const * Unit::GetFactionTemplateEntry ( ) const
10058{
10059 FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(GetFaction());
10060 if (!entry)
10061 {
10062 static ObjectGuid guid; // prevent repeating spam same faction problem
10063
10064 if (GetGUID() != guid)
10065 {
10066 if (Player const* player = ToPlayer())
10067 LOG_ERROR("entities.unit", "Player {} has invalid faction (faction template id) #{}", player->GetName(), GetFaction());
10068 else if (Creature const* creature = ToCreature())
10069 LOG_ERROR("entities.unit", "Creature (template id: {}) has invalid faction (faction template id) #{}", creature->GetCreatureTemplate()->Entry, GetFaction());
10070 else
10071 LOG_ERROR("entities.unit", "Unit (name={}, type={}) has invalid faction (faction template id) #{}", GetName(), uint32(GetTypeId()), GetFaction());
10072
10073 guid = GetGUID();
10074 }
10075 }
10076 return entry;
10077}
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
TypeID GetTypeId() const
Definition Object.h:127
uint32 GetFaction() const
Definition Unit.h:814
std::string const & GetName() const
Definition Object.h:463

References GetFaction(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), LOG_ERROR, sFactionTemplateStore, Object::ToCreature(), and Object::ToPlayer().

Referenced by _IsValidAttackTarget(), Player::CanUseBattlegroundObject(), HostileRefMgr::deleteReferencesForFaction(), Spell::EffectGameObjectDamage(), GetDispellableAuraList(), GetFactionReactionTo(), GetReactionTo(), Player::GetReputationPriceDiscount(), IsContestedGuard(), IsHostileToPlayers(), IsNeutralToAll(), npc_chesspiece::OnCharmed(), and PatchValuesUpdate().

◆ GetFirstControlled()

Unit * Unit::GetFirstControlled ( ) const
11099{
11100 // Sequence: charmed, pet, other guardians
11101 Unit* unit = GetCharm();
11102 if (!unit)
11103 if (ObjectGuid guid = GetMinionGUID())
11104 unit = ObjectAccessor::GetUnit(*this, guid);
11105
11106 return unit;
11107}
ObjectGuid GetMinionGUID() const
Definition Unit.h:688

References GetCharm(), GetMinionGUID(), and ObjectAccessor::GetUnit().

Referenced by Player::CharmSpellInitialize(), CombatStart(), WorldSession::HandlePetSetAction(), and RemoveCharmedBy().

◆ GetFirstMinion()

Minion * Unit::GetFirstMinion ( ) const
10660{
10661 if (ObjectGuid pet_guid = GetMinionGUID())
10662 {
10663 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
10664 if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
10665 return (Minion*)pet;
10666
10667 LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion {} not exist.", pet_guid.ToString());
10668 const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
10669 }
10670
10671 return nullptr;
10672}
void SetMinionGUID(ObjectGuid guid)
Definition Unit.h:689
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition ObjectAccessor.cpp:234

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetMinionGUID(), LOG_ERROR, SetMinionGUID(), and UNIT_MASK_MINION.

◆ GetFollowAngle()

◆ GetGameObject()

GameObject * Unit::GetGameObject ( uint32  spellId) const
6193{
6194 for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr)
6195 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6196 if (go->GetSpellId() == spellId)
6197 return go;
6198
6199 return nullptr;
6200}

References ObjectAccessor::GetGameObject(), and m_gameObj.

Referenced by Player::GetGameObjectIfCanInteractWith(), and Player::TeleportTo().

◆ getGender()

◆ GetGuardianPet()

Guardian * Unit::GetGuardianPet ( ) const
10675{
10676 if (ObjectGuid pet_guid = GetPetGUID())
10677 {
10678 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
10679 if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
10680 return (Guardian*)pet;
10681
10682 LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian {} not exist.", pet_guid.ToString());
10683 const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
10684 }
10685
10686 return nullptr;
10687}
#define LOG_FATAL(filterType__,...)
Definition Log.h:153
Definition TemporarySummon.h:96
void SetPetGUID(ObjectGuid guid)
Definition Unit.h:693
ObjectGuid GetPetGUID() const
Definition Unit.h:694

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetPetGUID(), LOG_FATAL, SetPetGUID(), and UNIT_MASK_GUARDIAN.

Referenced by spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Spell::EffectSummonPet(), GetNextRandomRaidMemberOrPet(), AuraEffect::HandleAuraDummy(), HandleAuraRaidProcFromChargeWithValue(), HandleDummyAuraProc(), AuraEffect::HandleModDamageDone(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), Spell::SelectImplicitCasterObjectTargets(), and SetMinion().

◆ GetHealth()

uint32 Unit::GetHealth ( ) const
inline
@ UNIT_FIELD_HEALTH
Definition UpdateFields.h:96

References Object::GetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_SaveCharacter(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), Spell::CheckPower(), CountPctFromCurHealth(), ScriptedAI::DamageTaken(), boss_eregos::boss_eregosAI::DamageTaken(), boss_razorgore::boss_razorgoreAI::DamageTaken(), boss_majordomo::boss_majordomoAI::DamageTaken(), boss_ragnaros::boss_ragnarosAI::DamageTaken(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_julianne::DamageTaken(), boss_romulo::DamageTaken(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_muru::DamageTaken(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), npc_amanitar_mushrooms::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_announcer_toc5::npc_announcer_toc5AI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_ick::boss_ickAI::DamageTaken(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::DamageTaken(), boss_drakkari_colossus::boss_drakkari_colossusAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), npc_collapsing_star::npc_collapsing_starAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_akama_illidan::DamageTaken(), npc_maiev_illidan::DamageTaken(), boss_illidari_council::DamageTaken(), boss_illidari_council_memberAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_akama_shade::DamageTaken(), boss_the_lurker_below::DamageTaken(), npc_shattered_hand_scout::DamageTaken(), boss_alar::DamageTaken(), advisor_baseAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_hor_leader_second::npc_hor_leader_secondAI::DamageTaken(), npc_ice_tomb::npc_ice_tombAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_nightbane::DamageTaken(), boss_thekal::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_illidan_stormrage::DamageTaken(), npc_garr_firesworn::npc_garr_fireswornAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), SmartAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kologarn::boss_kologarnAI::DamageTaken(), boss_kologarn_arms::boss_kologarn_armsAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), DealDamage(), DealMeleeDamage(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectHealMaxHealth(), Spell::EffectInstaKill(), Pet::FillPetInfo(), boss_supremus::FindHatefulStrikeTarget(), GetHealthGain(), GetHealthPct(), spell_illidari_council_empyreal_balance::HandleAfterCast(), spell_illidari_council_empyreal_equivalency::HandleAfterCast(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_rajaxx_thundercrash::HandleDamageCalc(), misc_commandscript::HandleDieCommand(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), npc_commandscript::HandleNpcInfoCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), IsFullHealth(), npc_dirt_mound::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), Kill(), ModifyHealth(), spell_xt002_gravity_bomb_aura::OnPeriodic(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthPctOrderPred::operator()(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::ResetPlayerDamageReq(), Player::SaveHealthBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), SendAttackStateUpdate(), SendSpellNonMeleeDamageLog(), SendSpellNonMeleeReflectLog(), SetMaxHealth(), boss_eadric::boss_eadricAI::SpellHit(), boss_headless_horseman_head::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), boss_ouro::Submerge(), Aura::Update(), boss_headless_horseman::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), Player::UpdateCharmedAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ GetHealthGain()

int32 Unit::GetHealthGain ( int32  dVal)
14147{
14148 int32 gain = 0;
14149
14150 if (dVal == 0)
14151 return 0;
14152
14153 int32 curHealth = (int32)GetHealth();
14154
14155 int32 val = dVal + curHealth;
14156 if (val <= 0)
14157 {
14158 return -curHealth;
14159 }
14160
14161 int32 maxHealth = (int32)GetMaxHealth();
14162
14163 if (val < maxHealth)
14164 gain = dVal;
14165 else if (curHealth != maxHealth)
14166 gain = maxHealth - curHealth;
14167
14168 return gain;
14169}

References GetHealth(), and GetMaxHealth().

Referenced by Spell::DoAllEffectOnTarget().

◆ GetHealthPct()

◆ getHostileRefMgr()

◆ GetHoverHeight()

float Unit::GetHoverHeight ( ) const
inline

◆ GetInterruptMask()

uint32 Unit::GetInterruptMask ( ) const
inline
1525{ return m_interruptMask; }

References m_interruptMask.

◆ GetLastDamagedTargetGuid()

ObjectGuid const & Unit::GetLastDamagedTargetGuid ( ) const
inline
923{ return _lastDamagedTargetGuid; }

References _lastDamagedTargetGuid.

◆ GetLastExtraAttackSpell()

uint32 Unit::GetLastExtraAttackSpell ( ) const
inline
960{ return _lastExtraAttackSpell; }

References _lastExtraAttackSpell.

Referenced by HandleProcTriggerSpell().

◆ GetLevel()

uint8 Unit::GetLevel ( ) const
inline
@ UNIT_FIELD_LEVEL
Definition UpdateFields.h:114

References Object::GetUInt32Value(), and UNIT_FIELD_LEVEL.

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDamage(), KillRewarder::_InitGroupData(), Pet::_LoadAuras(), KillRewarder::_RewardPlayer(), KillRewarder::_RewardXP(), Player::_SaveCharacter(), Player::_SaveStats(), spell_pal_ardent_defender::Absorb(), Pet::addSpell(), Spell::AddUnitTarget(), Player::ApplyEnchantment(), AuraEffect::AuraEffect(), BattlegroundMgr::BuildBattlegroundListPacket(), WorldSession::BuildPartyMemberStatsChangedPacket(), CalcArmorReducedDamage(), SpellInfo::CalcPowerCost(), SpellEffectInfo::CalcRadius(), spell_gen_disabled_above_63::CalculateAmount(), spell_item_arcane_shroud::CalculateAmount(), spell_item_the_eye_of_diminution::CalculateAmount(), AuraEffect::CalculateAmount(), CalculateLevelPenalty(), CalculateMeleeDamage(), Player::CalculateMinMaxDamage(), Player::CalculateQuestRewardXP(), Player::CalculateReputationGain(), Player::CalculateTalentsPoints(), SpellEffectInfo::CalcValue(), Player::CanEquipItem(), Group::CanJoinBattlegroundQueue(), Player::CanSeeStartQuest(), Player::CanUseItem(), Player::CheckAreaExploreAndOutdoor(), spell_hun_tame_beast::CheckCast(), Spell::CheckCast(), Spell::CheckEffectTarget(), spell_gen_proc_above_75::CheckLevel(), spell_gen_proc_reduced_above_60::CheckProc(), spell_item_green_whelp_armor::CheckProc(), Pet::CreateBaseAtTamed(), Player::CreatePet(), Player::CreatePet(), CreateTamedPetFrom(), CreateTamedPetFrom(), DealMeleeDamage(), DoLowUnlearnCost(), DoMedUnlearnCost(), Spell::DoSpellHitOnUnit(), Spell::EffectAddHonor(), Spell::EffectApplyGlyph(), Spell::EffectDuel(), Spell::EffectEnergize(), Spell::EffectSchoolDMG(), Spell::EffectSkinning(), Spell::EffectTameCreature(), Pet::FillPetInfo(), lfg::LFGMgr::FinishDungeon(), Acore::XP::Gain(), Player::GetAverageItemLevel(), Player::GetAverageItemLevelForDF(), Player::GetBarberShopCost(), Player::GetBGAccessByLevel(), Pet::GetCurrentFoodBenefitLevel(), npc_wg_quest_giver::GetDialogStatus(), Player::GetDodgeFromAgility(), GetEffectiveResistChance(), SocialMgr::GetFriendInfo(), getLevelForTarget(), Creature::getLevelForTarget(), GetMaxSkillValueForLevel(), Player::GetMeleeCritFromAgility(), Pet::GetNativeObjectScale(), Player::GetQuestDialogStatus(), Player::GetQuestLevel(), Player::GetRatingMultiplier(), Creature::GetShieldBlockValue(), Player::GetSpellCritFromIntellect(), Player::GetsRecruitAFriendBonus(), Player::GetTrainerSpellState(), GetUnitMeleeSkill(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), WorldSession::HandleAcceptGrantLevel(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), WorldSession::HandleCastSpellOpcode(), Player::HandleDrowning(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), WorldSession::HandleMessagechatOpcode(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandleOfferPetitionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionSignOpcode(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_pri_divine_aegis::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), reset_commandscript::HandleResetLevelCommand(), spell_wintergrasp_portal::HandleScript(), spell_item_scroll_of_recall::HandleScript(), WorldSession::HandleSendMail(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), Player::InitGlyphsForLevel(), lfg::LFGMgr::InitializeLockedDungeons(), Pet::InitLevelupSpellsForLevel(), Puppet::InitStats(), TempSummon::InitStats(), Player::InitStatsForLevel(), Pet::InitTalentForLevel(), Player::InitTaxiNodesForLevel(), Battlefield::InvitePlayerToWar(), Creature::isCanTrainingAndResetTalentsOf(), Player::isHonorOrXPTarget(), Player::IsMaxLevel(), Player::LearnDefaultSkill(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), AchievementCriteriaData::Meets(), MeleeSpellHitResult(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), spell_item_with_mount_speed::OnApply(), item_generic_limit_chance_above_60::OnCastItemCombatSpell(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), Player::OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), Player::PrepareGossipMenu(), Player::Regenerate(), Player::RegenerateHealth(), Player::RemovedInsignia(), Pet::removeSpell(), Pet::resetTalents(), Player::ResurrectPlayer(), Player::RewardHonor(), Player::RewardQuest(), RewardRage(), Player::RewardReputation(), RollMeleeOutcomeAgainst(), ArenaTeam::Roster(), Player::Satisfy(), Player::SatisfyQuestLevel(), Pet::SavePetToDB(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), WorldSession::SendLfgPlayerReward(), WorldSession::SendLfgRoleCheckUpdate(), Player::SendLoot(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestQueryResponse(), Player::SendQuestReward(), ObjectMgr::SendServerMail(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), Player::SetRestBonus(), Guild::Member::SetStats(), SpellPctDamageModsDone(), Spell::SummonGuardian(), Player::SummonPet(), Pet::SynchronizeLevelWithOwner(), Aura::Update(), npc_pet_hunter_snake_trap::UpdateAI(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCombatSkills(), Creature::UpdateEntry(), lfg::LFGMgr::UpdateRaidBrowser(), and GameObject::Use().

◆ getLevelForTarget()

◆ GetMagicHitRedirectTarget()

Unit * Unit::GetMagicHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo 
)
11043{
11044 // Patch 1.2 notes: Spell Reflection no longer reflects abilities
11045 if (spellInfo->HasAttribute(SPELL_ATTR0_IS_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR1_NO_REDIRECTION) || spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
11046 return victim;
11047
11049 for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
11050 {
11051 if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
11052 if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
11053 //&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
11054 && _IsValidAttackTarget(magnet, spellInfo)
11055 /*&& IsWithinLOSInMap(magnet)*/)
11056 {
11057 // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number
11058 magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100));
11059
11060 if (magnet->IsTotem())
11061 {
11062 uint64 queueTime = magnet->m_Events.CalculateQueueTime(100);
11063 if (spellInfo->Speed > 0.0f)
11064 {
11065 float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ());
11066 if (dist < 5.0f)
11067 dist = 5.0f;
11068 queueTime = magnet->m_Events.CalculateTime((uint64)std::floor(dist / spellInfo->Speed * 1000.0f));
11069 }
11070
11071 magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime);
11072 }
11073
11074 return magnet;
11075 }
11076 }
11077 return victim;
11078}
@ SPELL_ATTR1_NO_REDIRECTION
Definition SharedDefines.h:422
@ SPELL_ATTR0_IS_ABILITY
Definition SharedDefines.h:386
@ SPELL_AURA_SPELL_MAGNET
Definition SpellAuraDefines.h:159
Definition TotemAI.h:47
Definition Unit.h:2234
bool _IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
Definition Unit.cpp:13900
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1256

References _IsValidAttackTarget(), SpellInfo::CheckExplicitTarget(), GetAuraEffectsByType(), WorldObject::GetDistance(), Object::GetGUID(), SpellInfo::HasAttribute(), SpellInfo::Speed, SPELL_ATTR0_IS_ABILITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_NO_REDIRECTION, SPELL_AURA_SPELL_MAGNET, and SPELL_CAST_OK.

Referenced by Spell::SelectExplicitTargets().

◆ GetMaxHealth()

uint32 Unit::GetMaxHealth ( ) const
inline
@ UNIT_FIELD_MAXHEALTH
Definition UpdateFields.h:104

References Object::GetUInt32Value(), and UNIT_FIELD_MAXHEALTH.

Referenced by Player::_SaveStats(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_viscidus::boss_viscidus(), WorldSession::BuildPartyMemberStatsChangedPacket(), spell_item_skull_of_impeding_doom::CalculateDamageAmount(), CountPctFromMaxHealth(), boss_eregos::boss_eregosAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_alar::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_twinemperorsAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), Spell::EffectHealMaxHealth(), Spell::EffectSummonPet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), Acore::XP::Gain(), GetHealthGain(), GetHealthPct(), npc_echo_of_medivh::GetPiece(), spell_illidari_council_empyreal_balance::HandleAfterCast(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), HandleAuraProc(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcInfoCommand(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceJustDied(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_stinky_precious_decimate::HandleScript(), IsFullHealth(), boss_twin_valkyrAI::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustEngagedWith(), boss_ingvar_the_plunderer::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Acore::HealthPctOrderPred::operator()(), Player::outDebugValues(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetFullHealth(), SetHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), boss_viscidus::SummonedCreatureDies(), boss_headless_horseman::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxNegativeAuraModifier()

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auratype) const
5973{
5974 int32 modifier = 0;
5975
5976 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5977 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5978 if ((*i)->GetAmount() < modifier)
5979 modifier = (*i)->GetAmount();
5980
5981 return modifier;
5982}

References GetAuraEffectsByType().

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), SpellHealingBonusTaken(), and UpdateSpeed().

◆ GetMaxNegativeAuraModifierByAffectMask()

int32 Unit::GetMaxNegativeAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6128{
6129 int32 modifier = 0;
6130
6131 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6132 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6133 {
6134 if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() < modifier)
6135 modifier = (*i)->GetAmount();
6136 }
6137
6138 return modifier;
6139}

References GetAuraEffectsByType().

◆ GetMaxNegativeAuraModifierByMiscMask()

int32 Unit::GetMaxNegativeAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
6024{
6025 int32 modifier = 0;
6026
6027 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6028 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6029 {
6030 if ((*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() < modifier)
6031 modifier = (*i)->GetAmount();
6032 }
6033
6034 return modifier;
6035}

References GetAuraEffectsByType().

Referenced by SpellTakenCritChance().

◆ GetMaxNegativeAuraModifierByMiscValue()

int32 Unit::GetMaxNegativeAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6076{
6077 int32 modifier = 0;
6078
6079 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6080 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6081 {
6082 if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() < modifier)
6083 modifier = (*i)->GetAmount();
6084 }
6085
6086 return modifier;
6087}

References GetAuraEffectsByType().

Referenced by MagicSpellHitResult(), and ModSpellDuration().

◆ GetMaxPositiveAuraModifier()

int32 Unit::GetMaxPositiveAuraModifier ( AuraType  auratype)
5959{
5960 int32 modifier = 0;
5961
5962 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5963 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5964 {
5965 if ((*i)->GetAmount() > modifier)
5966 modifier = (*i)->GetAmount();
5967 }
5968
5969 return modifier;
5970}

References GetAuraEffectsByType().

Referenced by CalculateSpellAmount(), AuraEffect::HandlePeriodicHealAurasTick(), Player::RewardHonor(), SpellHealingBonusTaken(), and UpdateSpeed().

◆ GetMaxPositiveAuraModifierByAffectMask()

int32 Unit::GetMaxPositiveAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6114{
6115 int32 modifier = 0;
6116
6117 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6118 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6119 {
6120 if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() > modifier)
6121 modifier = (*i)->GetAmount();
6122 }
6123
6124 return modifier;
6125}

References GetAuraEffectsByType().

◆ GetMaxPositiveAuraModifierByMiscMask()

int32 Unit::GetMaxPositiveAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask,
const AuraEffect except = nullptr 
) const
6010{
6011 int32 modifier = 0;
6012
6013 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6014 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6015 {
6016 if (except != (*i) && (*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() > modifier)
6017 modifier = (*i)->GetAmount();
6018 }
6019
6020 return modifier;
6021}

References GetAuraEffectsByType(), and AuraEffect::GetMiscValue().

Referenced by AuraEffect::HandleAuraModResistanceExclusive(), and SpellTakenCritChance().

◆ GetMaxPositiveAuraModifierByMiscValue()

int32 Unit::GetMaxPositiveAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6062{
6063 int32 modifier = 0;
6064
6065 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6066 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6067 {
6068 if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() > modifier)
6069 modifier = (*i)->GetAmount();
6070 }
6071
6072 return modifier;
6073}

References GetAuraEffectsByType().

Referenced by MagicSpellHitResult().

◆ GetMaxPower()

uint32 Unit::GetMaxPower ( Powers  power) const
inline
1063{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power); }
@ UNIT_FIELD_MAXPOWER1
Definition UpdateFields.h:105

References Object::GetUInt32Value(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::_SaveStats(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_gen_replenishment_aura::CalculateAmount(), spell_item_skull_of_impeding_doom::CalculateManaLeechAmount(), Spell::CheckItems(), Player::Create(), boss_shade_of_aran::DamageTaken(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), GetPowerPct(), Player::GiveLevel(), HandleAuraProc(), Aura::HandleAuraSpecificMods(), HandleDummyAuraProc(), modify_commandscript::HandleModifyEnergyCommand(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_hun_ascpect_of_the_viper::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_kelthuzad_detonate_mana_aura::HandleScript(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), boss_curator::JustEngagedWith(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), ModifyPowerPct(), boss_shade_of_aran::OnPowerUpdate(), boss_selin_fireheart::OnPowerUpdate(), Acore::PowerPctOrderPred::operator()(), Acore::PowerPctOrderPred::operator()(), Player::outDebugValues(), spell_item_oracle_ablutions::PrepareSpellScript(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), spell_bronjahm_magic_bane::RecalculateDamage(), Creature::Regenerate(), Player::Regenerate(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetPower(), setPowerType(), Player::SummonPet(), boss_moam::UpdateAI(), boss_faction_championsAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), Player::UpdateCharmedAI(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxSkillValueForLevel()

uint16 Unit::GetMaxSkillValueForLevel ( Unit const *  target = nullptr) const
inline
1136{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
uint8 getLevelForTarget(WorldObject const *) const override
Definition Unit.h:1031

References GetLevel(), and getLevelForTarget().

Referenced by Player::GetMaxSkillValueForLevel(), GetUnitCriticalChance(), GetWeaponSkillValue(), isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), RollMeleeOutcomeAgainst(), and SpellTakenCritChance().

◆ GetMechanicResistChance()

int32 Unit::GetMechanicResistChance ( SpellInfo const *  spell)
3134{
3135 if (!spell)
3136 return 0;
3137 int32 resist_mech = 0;
3138 for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
3139 {
3140 if (!spell->Effects[eff].IsEffect())
3141 break;
3142 int32 effect_mech = spell->GetEffectMechanic(eff);
3143 if (effect_mech)
3144 {
3146 if (resist_mech < temp)
3147 resist_mech = temp;
3148 }
3149 }
3150 return resist_mech;
3151}
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition SpellAuraDefines.h:180
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6037

References SpellInfo::Effects, SpellInfo::GetEffectMechanic(), GetTotalAuraModifierByMiscValue(), MAX_SPELL_EFFECTS, and SPELL_AURA_MOD_MECHANIC_RESISTANCE.

Referenced by MagicSpellHitResult(), and MeleeSpellHitResult().

◆ GetMeleeAttackPoint()

bool Unit::GetMeleeAttackPoint ( Unit attacker,
Position pos 
)
2668{
2669 if (!attacker)
2670 {
2671 return false;
2672 }
2673
2674 AttackerSet attackers = getAttackers();
2675
2676 if (attackers.size() <= 1) // if the attackers are not more than one
2677 {
2678 return false;
2679 }
2680
2681 float meleeReach = GetExactDist2d(attacker);
2682 if (meleeReach <= 0)
2683 {
2684 return false;
2685 }
2686
2687 float minAngle = 0;
2688 Unit *refUnit = nullptr;
2689 uint32 validAttackers = 0;
2690
2691 double attackerSize = attacker->GetCollisionRadius();
2692
2693 for (auto const& otherAttacker: attackers)
2694 {
2695 // if the otherAttacker is not valid, skip
2696 if (!otherAttacker || otherAttacker->GetGUID() == attacker->GetGUID() ||
2697 !otherAttacker->IsWithinMeleeRange(this) || otherAttacker->isMoving())
2698 {
2699 continue;
2700 }
2701
2702 float curretAngle = atan(attacker->GetExactDist2d(otherAttacker) / meleeReach);
2703 if (minAngle == 0 || curretAngle < minAngle)
2704 {
2705 minAngle = curretAngle;
2706 refUnit = otherAttacker;
2707 }
2708
2709 validAttackers++;
2710 }
2711
2712 if (!validAttackers || !refUnit)
2713 {
2714 return false;
2715 }
2716
2717 float contactDist = attackerSize + refUnit->GetCollisionRadius();
2718 float requiredAngle = atan(contactDist / meleeReach);
2719 float attackersAngle = atan(attacker->GetExactDist2d(refUnit) / meleeReach);
2720
2721 // in instance: the more attacker there are, the higher will be the tollerance
2722 // outside: creatures should not intersecate
2723 float angleTollerance = attacker->GetMap()->IsDungeon() ? requiredAngle - requiredAngle * tanh(validAttackers / 5.0f) : requiredAngle;
2724
2725 if (attackersAngle > angleTollerance)
2726 {
2727 return false;
2728 }
2729
2730 double angle = atan(contactDist / meleeReach);
2731
2732 float angularRadius = frand(0.1f, 0.3f) + angle;
2733 int8 direction = (urand(0, 1) ? -1 : 1);
2734 float currentAngle = GetAngle(refUnit);
2735 float absAngle = currentAngle + angularRadius * direction;
2736
2737 float x, y, z;
2738 float distance = meleeReach - GetObjectSize();
2739 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle);
2740
2741 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2742 {
2743 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle * -1); // try the other side
2744
2745 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2746 {
2747 return false;
2748 }
2749 }
2750
2751 pos.Relocate(x, y, z);
2752
2753 return true;
2754}
std::int8_t int8
Definition Define.h:105
float frand(float min, float max)
Definition Random.cpp:57
bool IsDungeon() const
Definition Map.h:446
float GetCollisionRadius() const override
this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by t...
Definition Unit.cpp:21123
std::unordered_set< Unit * > AttackerSet
Definition Unit.h:638
AttackerSet const & getAttackers() const
Definition Unit.h:856
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
Definition Object.cpp:2639
float GetExactDist2d(const float x, const float y) const
Definition Position.h:165

References frand(), Position::GetAngle(), getAttackers(), GetCollisionRadius(), Position::GetExactDist2d(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetNearPoint(), WorldObject::GetObjectSize(), Map::IsDungeon(), Position::Relocate(), and urand().

Referenced by MotionMaster::MoveCircleTarget().

◆ GetMeleeCritChanceReduction()

float Unit::GetMeleeCritChanceReduction ( ) const
inline

◆ GetMeleeCritDamageReduction()

uint32 Unit::GetMeleeCritDamageReduction ( uint32  damage) const
inline
1205{ return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
Definition Unit.cpp:19217

References CR_CRIT_TAKEN_MELEE, and GetCombatRatingDamageReduction().

Referenced by ApplyResilience(), and processDummyAuras().

◆ GetMeleeDamageReduction()

uint32 Unit::GetMeleeDamageReduction ( uint32  damage) const
inline

◆ GetMeleeDamageSchoolMask()

virtual SpellSchoolMask Unit::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
pure virtual

Implemented in Player, and Creature.

Referenced by CalculateMeleeDamage().

◆ GetMeleeHitRedirectTarget()

Unit * Unit::GetMeleeHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo = nullptr 
)
11081{
11083 for (AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
11084 {
11085 if (Unit* magnet = (*i)->GetBase()->GetCaster())
11086 if (_IsValidAttackTarget(magnet, spellInfo) && magnet->IsWithinLOSInMap(this)
11087 && (!spellInfo || (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
11088 && spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK)))
11089 if (roll_chance_i((*i)->GetAmount()))
11090 {
11091 (*i)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
11092 return magnet;
11093 }
11094 }
11095 return victim;
11096}
bool roll_chance_i(int chance)
Definition Random.h:59
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
Definition SpellAuraDefines.h:174

References _IsValidAttackTarget(), AURA_REMOVE_BY_EXPIRE, SpellInfo::CheckExplicitTarget(), SpellInfo::CheckTarget(), GetAuraEffectsByType(), roll_chance_i(), SPELL_AURA_ADD_CASTER_HIT_TRIGGER, and SPELL_CAST_OK.

Referenced by AttackerStateUpdate(), spell_dk_dancing_rune_weapon::HandleProc(), and Spell::SelectExplicitTargets().

◆ GetMeleeRange()

float Unit::GetMeleeRange ( Unit const *  target) const
680{
681 float range = GetCombatReach() + target->GetCombatReach() + 4.0f / 3.0f;
682 return std::max(range, NOMINAL_MELEE_RANGE);
683}
#define NOMINAL_MELEE_RANGE
Definition ObjectDefines.h:48
float GetCombatReach() const override
Definition Unit.h:834

References GetCombatReach(), and NOMINAL_MELEE_RANGE.

Referenced by GetRandomContactPoint(), IsWithinMeleeRange(), CreatureAI::MoveBackwardsChecks(), and SmartScript::ProcessAction().

◆ GetMeleeReach()

float Unit::GetMeleeReach ( ) const
inline
835{ float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; }
#define MIN_MELEE_REACH
Definition ObjectDefines.h:47

References Object::m_floatValues, MIN_MELEE_REACH, and UNIT_FIELD_COMBATREACH.

Referenced by boss_veknilash::JustEngagedWith(), and npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI().

◆ GetMinionGUID()

ObjectGuid Unit::GetMinionGUID ( ) const
inline
@ UNIT_FIELD_SUMMON
Definition UpdateFields.h:87

References Object::GetGuidValue(), and UNIT_FIELD_SUMMON.

Referenced by GetFirstControlled(), GetFirstMinion(), and OutDebugInfo().

◆ GetModelForForm()

uint32 Unit::GetModelForForm ( ShapeshiftForm  form,
uint32  spellId 
) const
19224{
19225 // Hardcoded cases
19226 switch (spellId)
19227 {
19228 case 7090: // Bear form
19229 return 29414;
19230 case 35200: // Roc form
19231 return 4877;
19232 default:
19233 break;
19234 }
19235
19236 if (IsPlayer())
19237 {
19238 switch (form)
19239 {
19240 case FORM_CAT:
19241 // Based on Hair color
19242 if (getRace() == RACE_NIGHTELF)
19243 {
19244 uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
19245 switch (hairColor)
19246 {
19247 case 7: // Violet
19248 case 8:
19249 return 29405;
19250 case 3: // Light Blue
19251 return 29406;
19252 case 0: // Green
19253 case 1: // Light Green
19254 case 2: // Dark Green
19255 return 29407;
19256 case 4: // White
19257 return 29408;
19258 default: // original - Dark Blue
19259 return 892;
19260 }
19261 }
19262 // Based on Skin color
19263 else if (getRace() == RACE_TAUREN)
19264 {
19265 uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
19266 // Male
19267 if (getGender() == GENDER_MALE)
19268 {
19269 switch (skinColor)
19270 {
19271 case 12: // White
19272 case 13:
19273 case 14:
19274 case 18: // Completly White
19275 return 29409;
19276 case 9: // Light Brown
19277 case 10:
19278 case 11:
19279 return 29410;
19280 case 6: // Brown
19281 case 7:
19282 case 8:
19283 return 29411;
19284 case 0: // Dark
19285 case 1:
19286 case 2:
19287 case 3: // Dark Grey
19288 case 4:
19289 case 5:
19290 return 29412;
19291 default: // original - Grey
19292 return 8571;
19293 }
19294 }
19295 // Female
19296 else switch (skinColor)
19297 {
19298 case 10: // White
19299 return 29409;
19300 case 6: // Light Brown
19301 case 7:
19302 return 29410;
19303 case 4: // Brown
19304 case 5:
19305 return 29411;
19306 case 0: // Dark
19307 case 1:
19308 case 2:
19309 case 3:
19310 return 29412;
19311 default: // original - Grey
19312 return 8571;
19313 }
19314 }
19316 return 892;
19317 else
19318 return 8571;
19319 case FORM_DIREBEAR:
19320 case FORM_BEAR:
19321 // Based on Hair color
19322 if (getRace() == RACE_NIGHTELF)
19323 {
19324 uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
19325 switch (hairColor)
19326 {
19327 case 0: // Green
19328 case 1: // Light Green
19329 case 2: // Dark Green
19330 return 29413; // 29415?
19331 case 6: // Dark Blue
19332 return 29414;
19333 case 4: // White
19334 return 29416;
19335 case 3: // Light Blue
19336 return 29417;
19337 default: // original - Violet
19338 return 2281;
19339 }
19340 }
19341 // Based on Skin color
19342 else if (getRace() == RACE_TAUREN)
19343 {
19344 uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
19345 // Male
19346 if (getGender() == GENDER_MALE)
19347 {
19348 switch (skinColor)
19349 {
19350 case 0: // Dark (Black)
19351 case 1:
19352 case 2:
19353 return 29418;
19354 case 3: // White
19355 case 4:
19356 case 5:
19357 case 12:
19358 case 13:
19359 case 14:
19360 return 29419;
19361 case 9: // Light Brown/Grey
19362 case 10:
19363 case 11:
19364 case 15:
19365 case 16:
19366 case 17:
19367 return 29420;
19368 case 18: // Completly White
19369 return 29421;
19370 default: // original - Brown
19371 return 2289;
19372 }
19373 }
19374 // Female
19375 else switch (skinColor)
19376 {
19377 case 0: // Dark (Black)
19378 case 1:
19379 return 29418;
19380 case 2: // White
19381 case 3:
19382 return 29419;
19383 case 6: // Light Brown/Grey
19384 case 7:
19385 case 8:
19386 case 9:
19387 return 29420;
19388 case 10: // Completly White
19389 return 29421;
19390 default: // original - Brown
19391 return 2289;
19392 }
19393 }
19395 return 2281;
19396 else
19397 return 2289;
19398 case FORM_FLIGHT:
19400 return 20857;
19401 return 20872;
19402 case FORM_FLIGHT_EPIC:
19404 return 21243;
19405 return 21244;
19406 default:
19407 break;
19408 }
19409 }
19410
19411 uint32 modelid = 0;
19412 SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(form);
19413 if (formEntry && formEntry->modelID_A)
19414 {
19415 // Take the alliance modelid as default
19416 if (!IsPlayer())
19417 return formEntry->modelID_A;
19418 else
19419 {
19421 modelid = formEntry->modelID_A;
19422 else
19423 modelid = formEntry->modelID_H;
19424
19425 // If the player is horde but there are no values for the horde modelid - take the alliance modelid
19426 if (!modelid && Player::TeamIdForRace(getRace()) == TEAM_HORDE)
19427 modelid = formEntry->modelID_A;
19428 }
19429 }
19430
19431 return modelid;
19432}
@ GENDER_MALE
Definition SharedDefines.h:61
@ RACE_NIGHTELF
Definition SharedDefines.h:74
@ RACE_TAUREN
Definition SharedDefines.h:76
@ TEAM_ALLIANCE
Definition SharedDefines.h:760
@ TEAM_HORDE
Definition SharedDefines.h:761
@ FORM_DIREBEAR
Definition UnitDefines.h:77
@ FORM_FLIGHT_EPIC
Definition UnitDefines.h:94
@ FORM_CAT
Definition UnitDefines.h:70
@ FORM_FLIGHT
Definition UnitDefines.h:96
@ FORM_BEAR
Definition UnitDefines.h:74
@ PLAYER_BYTES
Definition UpdateFields.h:181
static TeamId TeamIdForRace(uint8 race)
Definition Player.cpp:5861
uint8 getGender() const
Definition Unit.h:811
uint8 getRace(bool original=false) const
Definition Unit.cpp:21029
uint32 modelID_H
Definition DBCStructure.h:1826
uint32 modelID_A
Definition DBCStructure.h:1825

References FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_FLIGHT, FORM_FLIGHT_EPIC, GENDER_MALE, Object::GetByteValue(), getGender(), getRace(), Object::IsPlayer(), SpellShapeshiftFormEntry::modelID_A, SpellShapeshiftFormEntry::modelID_H, PLAYER_BYTES, RACE_NIGHTELF, RACE_TAUREN, sSpellShapeshiftFormStore, TEAM_ALLIANCE, TEAM_HORDE, and Player::TeamIdForRace().

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), and RestoreDisplayId().

◆ GetModelForTotem()

uint32 Unit::GetModelForTotem ( PlayerTotemType  totemType)
19435{
19436 switch (getRace())
19437 {
19438 case RACE_ORC:
19439 {
19440 switch (totemType)
19441 {
19442 case SUMMON_TYPE_TOTEM_FIRE: // fire
19443 return 30758;
19444 case SUMMON_TYPE_TOTEM_EARTH: // earth
19445 return 30757;
19446 case SUMMON_TYPE_TOTEM_WATER: // water
19447 return 30759;
19448 case SUMMON_TYPE_TOTEM_AIR: // air
19449 return 30756;
19450 }
19451 break;
19452 }
19453 case RACE_DWARF:
19454 {
19455 switch (totemType)
19456 {
19457 case SUMMON_TYPE_TOTEM_FIRE: // fire
19458 return 30754;
19459 case SUMMON_TYPE_TOTEM_EARTH: // earth
19460 return 30753;
19461 case SUMMON_TYPE_TOTEM_WATER: // water
19462 return 30755;
19463 case SUMMON_TYPE_TOTEM_AIR: // air
19464 return 30736;
19465 }
19466 break;
19467 }
19468 case RACE_TROLL:
19469 {
19470 switch (totemType)
19471 {
19472 case SUMMON_TYPE_TOTEM_FIRE: // fire
19473 return 30762;
19474 case SUMMON_TYPE_TOTEM_EARTH: // earth
19475 return 30761;
19476 case SUMMON_TYPE_TOTEM_WATER: // water
19477 return 30763;
19478 case SUMMON_TYPE_TOTEM_AIR: // air
19479 return 30760;
19480 }
19481 break;
19482 }
19483 case RACE_TAUREN:
19484 {
19485 switch (totemType)
19486 {
19487 case SUMMON_TYPE_TOTEM_FIRE: // fire
19488 return 4589;
19489 case SUMMON_TYPE_TOTEM_EARTH: // earth
19490 return 4588;
19491 case SUMMON_TYPE_TOTEM_WATER: // water
19492 return 4587;
19493 case SUMMON_TYPE_TOTEM_AIR: // air
19494 return 4590;
19495 }
19496 break;
19497 }
19498 case RACE_DRAENEI:
19499 {
19500 switch (totemType)
19501 {
19502 case SUMMON_TYPE_TOTEM_FIRE: // fire
19503 return 19074;
19504 case SUMMON_TYPE_TOTEM_EARTH: // earth
19505 return 19073;
19506 case SUMMON_TYPE_TOTEM_WATER: // water
19507 return 19075;
19508 case SUMMON_TYPE_TOTEM_AIR: // air
19509 return 19071;
19510 }
19511 break;
19512 }
19513 default: // One standard for other races.
19514 {
19515 switch (totemType)
19516 {
19517 case SUMMON_TYPE_TOTEM_FIRE: // fire
19518 return 4589;
19519 case SUMMON_TYPE_TOTEM_EARTH: // earth
19520 return 4588;
19521 case SUMMON_TYPE_TOTEM_WATER: // water
19522 return 4587;
19523 case SUMMON_TYPE_TOTEM_AIR: // air
19524 return 4590;
19525 }
19526 break;
19527 }
19528 }
19529 return 0;
19530}
@ RACE_TROLL
Definition SharedDefines.h:78
@ RACE_ORC
Definition SharedDefines.h:72
@ RACE_DRAENEI
Definition SharedDefines.h:81
@ RACE_DWARF
Definition SharedDefines.h:73
@ SUMMON_TYPE_TOTEM_EARTH
Definition Unit.h:614
@ SUMMON_TYPE_TOTEM_WATER
Definition Unit.h:615
@ SUMMON_TYPE_TOTEM_FIRE
Definition Unit.h:613
@ SUMMON_TYPE_TOTEM_AIR
Definition Unit.h:616

References getRace(), RACE_DRAENEI, RACE_DWARF, RACE_ORC, RACE_TAUREN, RACE_TROLL, SUMMON_TYPE_TOTEM_AIR, SUMMON_TYPE_TOTEM_EARTH, SUMMON_TYPE_TOTEM_FIRE, and SUMMON_TYPE_TOTEM_WATER.

◆ GetModifierValue()

float Unit::GetModifierValue ( UnitMods  unitMod,
UnitModifierType  modifierType 
) const
15312{
15313 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
15314 {
15315 LOG_ERROR("entities.unit", "attempt to access non-existing modifier value from UnitMods!");
15316 return 0.0f;
15317 }
15318
15319 if (modifierType == TOTAL_PCT && m_auraModifiersGroup[unitMod][modifierType] <= 0.0f)
15320 return 0.0f;
15321
15322 return m_auraModifiersGroup[unitMod][modifierType];
15323}
@ MODIFIER_TYPE_END
Definition Unit.h:130

References LOG_ERROR, m_auraModifiersGroup, MODIFIER_TYPE_END, TOTAL_PCT, and UNIT_MOD_END.

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectWeaponDmg(), Guardian::UpdateArmor(), Player::UpdateArmor(), Creature::UpdateAttackPowerAndDamage(), Guardian::UpdateAttackPowerAndDamage(), Player::UpdateAttackPowerAndDamage(), Guardian::UpdateDamagePhysical(), Guardian::UpdateMaxHealth(), Player::UpdateMaxHealth(), Guardian::UpdateMaxPower(), Player::UpdateMaxPower(), and Player::UpdateResistances().

◆ GetMotionMaster() [1/2]

MotionMaster * Unit::GetMotionMaster ( )
inline
1670{ return i_motionMaster; }

References i_motionMaster.

Referenced by _ExitVehicle(), HomeMovementGenerator< Creature >::_setTargetLocation(), PetAI::_stopAttack(), BattlegroundAV::AddAVCreature(), npc_mograine::npc_mograineAI::AshbringerEvent(), UnitAI::AttackStart(), FollowerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::AttackStart(), boss_magus_telestra::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_lady_malande::AttackStart(), boss_olm_the_summoner::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), UnitAI::AttackStartCaster(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CleanupBeforeRemoveFromMap(), boss_alar::ConstructWaypointsAndMove(), boss_isalien::DamageTaken(), boss_julianne::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_nightbane::DoAction(), npc_apothecary_genericAI::DoAction(), npc_harrison_jones::DoAction(), npc_amanishi_lookout::DoAction(), npc_chained_spirit::DoAction(), boss_anetheron::DoAction(), boss_azgalor::DoAction(), boss_kazrogal::DoAction(), boss_rage_winterchill::DoAction(), npc_hyjal_ground_trash::DoAction(), npc_hyjal_gargoyle::DoAction(), npc_hyjal_frost_wyrm::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_professor_putricide::boss_professor_putricideAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_argent_captainAI::DoAction(), npc_icc_spire_frostwyrm::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::DoAction(), npc_ahune_bunny::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), npc_power_spark::npc_power_sparkAI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_maiev_illidan::DoAction(), npc_akama_shade::DoAction(), boss_nazan::DoAction(), boss_ghazan::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), PetAI::DoAttack(), Creature::DoFleeToGetAssistance(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoStartMovement(), ScriptedAI::DoStartNoMovement(), go_commandscript::DoTeleport(), Spell::EffectCharge(), Spell::EffectChargeDest(), Spell::EffectDistract(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectPullTowards(), Spell::EffectSummonType(), boss_jindo::EnterEvadeMode(), npc_black_morass_summoned_add::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), npc_burning_spirit::npc_burning_spiritAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_mrfloppy::npc_mrfloppyAI::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), boss_halazzi::EnterPhase(), boss_zuljin::EnterPhase(), VehicleDespawnEvent::Execute(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), NpcRunToHome::Execute(), UtherBatteredHiltEvent::Execute(), SlaveRunEvent::Execute(), DelayedMovementEvent::Execute(), DaranavanMoveEvent::Execute(), FrostwyrmLandEvent::Execute(), SACActivateEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), AssistanceMovementGenerator::Finalize(), npc_dark_iron_guzzler::FindNextKeg(), npc_hallows_end_soh::FinishEvent(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_nightbane::FlyToClosestPreFlyWayPoint(), Creature::FocusTarget(), CreatureGroup::FormationReset(), boss_volkhan::boss_volkhanAI::GoToAnvil(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_apothecary_lingering_fumes::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), misc_commandscript::HandleAppearCommand(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), misc_commandscript::HandleComeToMeCommand(), spell_q12589_shoot_rjr::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q6124_6129_apply_salve::HandleDummy(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_icc_geist_alarm::HandleEvent(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), spell_item_toxic_wasteling::HandleJump(), AuraEffect::HandleModPossessPet(), misc_commandscript::HandleMovegensCommand(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcUnFollowCommand(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), spell_entropius_black_hole_effect::HandlePull(), spell_boss_magus_telestra_gravity_well::HandlePull(), PetAI::HandleReturnMovement(), spell_the_lich_king_valkyr_target_search::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_gen_ayamiss_swarmer_loop::HandleScript(), WorldSession::HandleSetRaidDifficultyOpcode(), spell_sindragosa_icy_grip_jump::HandleSpecial(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), spell_item_draenic_pale_ale::HandleSummon(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpUnLoadCommand(), boss_captain_skarloc::InitializeAI(), boss_lieutenant_drake::InitializeAI(), boss_glob_of_viscidus::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), boss_eck::boss_eckAI::InitializeAI(), npc_preparations_for_war_vehicle::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), boss_grand_warlock_nethekurse::IntroRP(), Creature::IsFreeToMove(), IsMutualChase(), boss_gahzranka::IsSummonedBy(), boss_aeonus::IsSummonedBy(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_burning_spirit::npc_burning_spiritAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::IsSummonedBy(), npc_spirit_shade::npc_spirit_shadeAI::IsSummonedBy(), JumpTo(), JumpTo(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), boss_ayamiss::JustDied(), boss_shade_of_aran::JustEngagedWith(), npc_cyclone::JustEngagedWith(), boss_akilzon::JustEngagedWith(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_grandmaster_vorpil::JustEngagedWith(), boss_warlord_kalithresh::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nazan::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_ayamiss::JustEngagedWith(), boss_janalai::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_alar::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), SmartAI::JustReachedHome(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), boss_ghazan::JustReachedHome(), boss_grand_warlock_nethekurse::JustReachedHome(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_auriaya::boss_auriayaAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), boss_mekgineer_steamrigger::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_xevozz::boss_xevozzAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::JustSummoned(), boss_ingvar_the_plunderer::JustSummoned(), boss_vexallus::JustSummoned(), npc_kalecgos_kj::JustSummoned(), boss_janalai::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_hadronox::boss_hadronoxAI::JustSummoned(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_akama_shade::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), boss_mennu_the_betrayer::JustSummoned(), boss_kaelthas::JustSummoned(), boss_mechano_lord_capacitus::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), boss_ayamiss::JustSummoned(), Player::KillPlayer(), KnockbackFrom(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderMoveTo(), Player::LeaveBattleground(), Creature::Motion_Initialize(), SmartAI::MoveAway(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), PetAI::MovementInform(), boss_ebonroc::boss_ebonrocAI::MovementInform(), boss_nightbane::MovementInform(), npc_harrison_jones::MovementInform(), boss_bug_trio::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), npc_akama_illidan::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), boss_felmyst::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_cameron::MoveTheChildren(), boss_four_horsemen::boss_four_horsemenAI::MoveToCorner(), npc_janalai_hatcher::MoveToNewWaypoint(), npc_concentrated_ball::npc_concentrated_ballAI::MoveToNextPoint(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), NearTeleportTo(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_omen::npc_omenAI::npc_omenAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::npc_pos_after_first_bossAI(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::npc_ulduar_saronite_vaporsAI(), spell_halion_twilight_phasing_aura::OnApply(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_hyjal_jaina::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_kernobee::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), spell_chapter5_light_of_dawn_aura::OnRemove(), spell_halion_twilight_phasing_aura::OnRemove(), SplineHandler::operator()(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_vics_flying_machine::npc_vics_flying_machineAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_anetheron::PathEndReached(), boss_rage_winterchill::PathEndReached(), npc_hyjal_ground_trash::PathEndReached(), npc_hyjal_frost_wyrm::PathEndReached(), boss_ambassador_hellmaw::PathEndReached(), npc_akama_illidan::PathEndReached(), boss_nefarian::PathEndReached(), npc_hyjal_gargoyle::PathEndReached(), PauseMovement(), SmartAI::PausePath(), PetSpellFail(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::PickNewLocation(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), propagateSpeedChange(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), RemoveCharmedBy(), boss_the_beast::boss_thebeastAI::Reset(), boss_felblood_kaelthas::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_kalec::Reset(), npc_singularity::Reset(), boss_janalai::Reset(), npc_janalai_hatcher::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_zulian_prowler::npc_zulian_prowlerAI::Reset(), npc_batrider::Reset(), npc_brew_bubble::Reset(), boss_archimonde::Reset(), boss_ayamiss::Reset(), boss_bug_trio::Reset(), boss_jedoga_shadowseeker::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_assembly_lightning::npc_assembly_lightningAI::Reset(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::Reset(), npc_voidtraveler::Reset(), boss_lady_vashj::Reset(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), npc_pet_gen_gnomish_flame_turret::Reset(), Creature::Respawn(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), ResumeMovement(), SmartAI::ResumePath(), Resurrect(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), boss_alar::ScheduleAbilities(), boss_illidan_stormrage::ScheduleAbilities(), boss_magtheridon::ScheduleCombatEvents(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), boss_felmyst::ScheduleFlightAbilities(), boss_felmyst::ScheduleFlightSequence(), boss_nightbane::ScheduleLand(), boss_laj::ScheduleTasks(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), WorldSession::SendDoFlight(), boss_sartharion::boss_sartharionAI::SendLavaWaves(), SetCharmedBy(), SmartAI::SetCombatMove(), SetConfused(), boss_grand_warlock_nethekurse::SetData(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::SetData(), gunship_npc_AI::SetData(), npc_enslaved_proto_drake::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_eastvale_peasent::SetData(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::SetData(), setDeathState(), Creature::setDeathState(), SetFeared(), SmartAI::SetFollow(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::SetGUID(), SetInCombatState(), Player::SetMover(), SetSpeed(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_harrison_jones::sGossipSelect(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_akama_illidan::sGossipSelect(), npc_akama_shade::sGossipSelect(), boss_thorim::boss_thorimAI::SpawnArenaNPCs(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), boss_attumen::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_forest_frog::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), npc_pet_gen_fetch_ball::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_escortAI::Start(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), FollowerAI::StartFollow(), boss_felmyst::StartIntro(), WaypointMovementGenerator< Creature >::StartMove(), npc_stillpine_capitive::npc_stillpine_capitiveAI::StartMoving(), SmartAI::StartPath(), SmartAI::StopFollow(), SmartAI::StopPath(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_vazruden_the_herald::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), Spell::SummonGuardian(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), Player::TeleportTo(), CreatureAI::TriggerAlert(), Pet::Update(), Update(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_gyth::boss_gythAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_cameron::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_akilzon_eagle::UpdateAI(), npc_forest_frog::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_demonic_vapor::UpdateAI(), npc_batrider::UpdateAI(), npc_concentrated_ball::npc_concentrated_ballAI::UpdateAI(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::UpdateAI(), npc_xt002_boombot::npc_xt002_boombotAI::UpdateAI(), Player::UpdateCharmedAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_emily::npc_emilyAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ GetMotionMaster() [2/2]

const MotionMaster * Unit::GetMotionMaster ( ) const
inline
1671{ return i_motionMaster; }

References i_motionMaster.

◆ GetMountID()

◆ GetNativeDisplayId()

◆ GetNativeObjectScale()

virtual float Unit::GetNativeObjectScale ( ) const
inlinevirtual

Reimplemented in Creature, and Pet.

1885{ return 1.0f; }

Referenced by RecalculateObjectScale().

◆ GetNegStat()

float Unit::GetNegStat ( Stats  stat) const
inline
1010{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_NEGSTAT0.

◆ GetNextRandomRaidMemberOrPet()

Unit * Unit::GetNextRandomRaidMemberOrPet ( float  radius)
11138{
11139 Player* player = nullptr;
11140 if (IsPlayer())
11141 player = ToPlayer();
11142 // Should we enable this also for charmed units?
11143 else if (IsCreature() && IsPet())
11144 player = GetOwner()->ToPlayer();
11145
11146 if (!player)
11147 return nullptr;
11148 Group* group = player->GetGroup();
11149 // When there is no group check pet presence
11150 if (!group)
11151 {
11152 // We are pet now, return owner
11153 if (player != this)
11154 return IsWithinDistInMap(player, radius) ? player : nullptr;
11155 Unit* pet = GetGuardianPet();
11156 // No pet, no group, nothing to return
11157 if (!pet)
11158 return nullptr;
11159 // We are owner now, return pet
11160 return IsWithinDistInMap(pet, radius) ? pet : nullptr;
11161 }
11162
11163 std::vector<Unit*> nearMembers;
11164 // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
11165 nearMembers.reserve(group->GetMembersCount() * 2);
11166
11167 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
11168 if (Player* Target = itr->GetSource())
11169 {
11170 if (Target != this && !IsWithinDistInMap(Target, radius))
11171 continue;
11172
11173 // IsHostileTo check duel and controlled by enemy
11174 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
11175 nearMembers.push_back(Target);
11176
11177 // Push player's pet to vector
11178 if (Unit* pet = Target->GetGuardianPet())
11179 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
11180 nearMembers.push_back(pet);
11181 }
11182
11183 if (nearMembers.empty())
11184 return nullptr;
11185
11186 uint32 randTarget = urand(0, nearMembers.size() - 1);
11187 return nearMembers[randTarget];
11188}
Definition GroupReference.h:27
Definition Group.h:169
uint32 GetMembersCount() const
Definition Group.h:245
GroupReference * GetFirstMember()
Definition Group.h:243
Group * GetGroup()
Definition Player.h:2471
Guardian * GetGuardianPet() const
Definition Unit.cpp:10674
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition Object.cpp:1332

References Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), Group::GetMembersCount(), GetOwner(), Object::IsCreature(), IsHostileTo(), IsPet(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), Object::ToPlayer(), and urand().

Referenced by HandleAuraRaidProcFromCharge(), and AuraEffect::HandleRaidProcFromChargeAuraProc().

◆ GetNpcFlags()

◆ GetOldFactionId()

uint32 Unit::GetOldFactionId ( ) const
inline
818{ return _oldFactionId; }

References _oldFactionId.

Referenced by npc_chesspiece::OnCharmed().

◆ GetOwnedAura()

Aura * Unit::GetOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
Aura except = nullptr 
) const
4761{
4762 AuraMapBounds range = m_ownedAuras.equal_range(spellId);
4763 for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
4764 {
4765 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
4766 && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
4767 && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
4768 && (!except || except != itr->second))
4769 {
4770 return itr->second;
4771 }
4772 }
4773 return nullptr;
4774}
std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
Definition Unit.h:642

References m_ownedAuras.

Referenced by _TryStackingOrRefreshingExistingAura().

◆ GetOwnedAuras() [1/2]

◆ GetOwnedAuras() [2/2]

AuraMap const & Unit::GetOwnedAuras ( ) const
inline
1301{ return m_ownedAuras; }

References m_ownedAuras.

◆ GetOwner()

Unit * Unit::GetOwner ( ) const
Todo:
: move this in Object class or move GetUInt32value here but keep consistency
10624{
10625 if (ObjectGuid ownerGUID = GetOwnerGUID())
10626 return ObjectAccessor::GetUnit(*this, ownerGUID);
10627
10628 return nullptr;
10629}

References GetOwnerGUID(), and ObjectAccessor::GetUnit().

Referenced by _ExitVehicle(), Acore::AnyAoETargetUnitInObjectRangeCheck::AnyAoETargetUnitInObjectRangeCheck(), ApplyDiminishingToDuration(), ApplyResilience(), TotemAI::AttackStart(), spell_dk_anti_magic_zone::CalculateAmount(), Creature::CanStartAttack(), spell_dk_blood_gorged::CheckProc(), spell_pri_mana_leech::CheckProc(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealHeal(), HostileRefMgr::deleteReferences(), npc_spring_rabbit::npc_spring_rabbitAI::DoAction(), Spell::DoAllEffectOnLaunchTarget(), Spell::DoAllEffectOnTarget(), PetAI::DoAttack(), Spell::EffectDispel(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), boss_illidari_council_memberAI::EnterEvadeMode(), GetCharmerOrOwner(), GetCombatRatingReduction(), GetNextRandomRaidMemberOrPet(), GetReactionTo(), GetSpellModOwner(), spell_warl_seduction::HandleAuraApply(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_sha_healing_stream_totem::HandleDummy(), spell_q12277_wintergarde_mine_explosion::HandleDummy(), spell_sha_mana_tide_totem::HandleDummy(), HandleDummyAuraProc(), spell_mount_check_aura::HandleEffectPeriodic(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), modify_commandscript::HandleModifyTalentCommand(), WorldSession::HandlePetActionHelper(), spell_warl_demonic_pact_aura::HandleProc(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), IsAlwaysVisibleFor(), IsPetAura(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::JustDied(), Kill(), MagicSpellHitResult(), MeleeDamageBonusDone(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_hun_aspect_of_the_beast::OnPetApply(), Acore::MostHPMissingGroupInRange::operator()(), PetSpellFail(), RemoveFromWorld(), npc_target_dummy::npc_target_dummyAI::Reset(), npc_spring_rabbit::npc_spring_rabbitAI::Reset(), RestoreFaction(), Creature::SelectVictim(), SendPetActionFeedback(), SendPetAIReaction(), SendPetTalk(), SetHealth(), SetMaxHealth(), SetMaxPower(), SetPower(), setPowerType(), SetStunned(), SpellDamageBonusDone(), SpellHealingBonusDone(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and UpdateAuraForGroup().

◆ GetOwnerGUID()

ObjectGuid Unit::GetOwnerGUID ( ) const
inline
@ UNIT_FIELD_SUMMONEDBY
Definition UpdateFields.h:90

References Object::GetGuidValue(), and UNIT_FIELD_SUMMONEDBY.

Referenced by Pet::AddToWorld(), npc_living_mojo::npc_living_mojoAI::AttackStart(), BuildValuesUpdate(), PetAI::CanAttack(), CanFreeMove(), CanHaveThreatList(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), DealDamage(), Spell::DoAllEffectOnTarget(), FollowMovementGenerator< T >::DoUpdate(), GetCharmerOrOwnerGUID(), GetOwner(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModStealthLevel(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetRename(), HandleSpellClick(), Creature::HasMechanicTemplateImmunity(), Creature::IsDungeonBoss(), Creature::IsImmuneToKnockback(), isInAccessiblePlaceFor(), Kill(), Creature::LoadSpellTemplateImmunity(), Condition::Meets(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_venomhide_hatchling::OnGossipHello(), Acore::MostHPMissingGroupInRange::operator()(), PlayerOrPetCheck::operator()(), OutDebugInfo(), PetAI::ReceiveEmote(), Creature::Regenerate(), RemoveAllControlled(), RemoveEvadeAuras(), Pet::SavePetToDB(), spell_item_fetch_ball::SelectTarget(), SetMinion(), SetOwnerGUID(), SpellPctDamageModsDone(), Map::SummonCreature(), NPCStaveQuestAI::UnitIsUnfair(), Creature::Update(), and npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI().

◆ GetPartyMembers()

void Unit::GetPartyMembers ( std::list< Unit * > &  units)
18843{
18844 Unit* owner = GetCharmerOrOwnerOrSelf();
18845 Group* group = nullptr;
18846 if (owner->IsPlayer())
18847 group = owner->ToPlayer()->GetGroup();
18848
18849 if (group)
18850 {
18851 uint8 subgroup = owner->ToPlayer()->GetSubGroup();
18852
18853 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
18854 {
18855 Player* Target = itr->GetSource();
18856
18857 // IsHostileTo check duel and controlled by enemy
18858 if (Target && Target->IsInMap(owner) && Target->GetSubGroup() == subgroup && !IsHostileTo(Target))
18859 {
18860 if (Target->IsAlive())
18861 TagUnitMap.push_back(Target);
18862
18863 for (Unit::ControlSet::iterator iterator = Target->m_Controlled.begin(); iterator != Target->m_Controlled.end(); ++iterator)
18864 {
18865 if (Unit* pet = *iterator)
18866 if (pet->IsGuardian() && pet->IsAlive())
18867 TagUnitMap.push_back(pet);
18868 }
18869 }
18870 }
18871 }
18872 else
18873 {
18874 if (owner->IsAlive())
18875 TagUnitMap.push_back(owner);
18876
18877 for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
18878 {
18879 if (Unit* pet = *itr)
18880 if (pet->IsGuardian() && pet->IsAlive())
18881 TagUnitMap.push_back(pet);
18882 }
18883 }
18884}
uint8 GetSubGroup() const
Definition Player.h:2475

References GetCharmerOrOwnerOrSelf(), Group::GetFirstMember(), Player::GetGroup(), Player::GetSubGroup(), IsAlive(), IsHostileTo(), WorldObject::IsInMap(), Object::IsPlayer(), m_Controlled, and Object::ToPlayer().

Referenced by spell_warr_improved_spell_reflection_trigger_aura::HandleRemove().

◆ GetPetGUID()

◆ GetPhaseByAuras()

uint32 Unit::GetPhaseByAuras ( ) const
19062{
19063 uint32 currentPhase = 0;
19065 if (!phases.empty())
19066 for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
19067 currentPhase |= (*itr)->GetMiscValue();
19068
19069 return currentPhase;
19070}
@ SPELL_AURA_PHASE
Definition SpellAuraDefines.h:324

References GetAuraEffectsByType(), and SPELL_AURA_PHASE.

Referenced by Player::GetPhaseMaskForSpawn(), AuraEffect::HandlePhase(), and Player::SetGameMaster().

◆ GetPosStat()

float Unit::GetPosStat ( Stats  stat) const
inline
1009{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_POSSTAT0.

◆ GetPower()

uint32 Unit::GetPower ( Powers  power) const
inline
1062{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power); }
@ UNIT_FIELD_POWER1
Definition UpdateFields.h:97

References Object::GetUInt32Value(), and UNIT_FIELD_POWER1.

Referenced by PetAI::_canMeleeAttack(), Player::_SaveCharacter(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_igb_cannon_blast::CalculatePower(), Creature::CanCastSpell(), Spell::CheckItems(), Spell::CheckPower(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), Spell::EffectCastButtons(), Spell::EffectWeaponDmg(), Pet::FillPetInfo(), Pet::GetHappinessState(), GetPowerPct(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), AuraEffect::HandleObsModPowerAuraTick(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetAbandon(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_pal_lay_on_hands::HandleScript(), Player::InitStatsForLevel(), boss_shade_of_aran::JustEngagedWith(), npc_obsidian_destroyer::JustEngagedWith(), spell_gen_replenishment_aura::Load(), Pet::LoseHappiness(), ModifyPower(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), Acore::PowerPctOrderPred::operator()(), Acore::PowerPctOrderPred::operator()(), SmartScript::ProcessAction(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::Regenerate(), Player::Regenerate(), Creature::RegenerateHealth(), Player::SaveManaBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), ScriptedAI::SelectSpell(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetMaxPower(), SetPower(), setPowerType(), spell_igb_incinerating_blast::StoreEnergy(), Aura::Update(), boss_moam::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), PetAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetPowerPct()

float Unit::GetPowerPct ( Powers  power) const
inline
1064{ return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1063
uint32 GetPower(Powers power) const
Definition Unit.h:1062

References GetMaxPower(), and GetPower().

Referenced by npc_obsidian_destroyer::JustEngagedWith(), npc_obsidian_eradicator::JustEngagedWith(), npc_obsidian_nullifier::JustEngagedWith(), boss_curator::JustEngagedWith(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), and boss_hazzarah::UpdateAI().

◆ getPowerType()

◆ GetPowerTypeByAuraGroup()

Powers Unit::GetPowerTypeByAuraGroup ( UnitMods  unitMod) const
15430{
15431 switch (unitMod)
15432 {
15433 case UNIT_MOD_RAGE:
15434 return POWER_RAGE;
15435 case UNIT_MOD_FOCUS:
15436 return POWER_FOCUS;
15437 case UNIT_MOD_ENERGY:
15438 return POWER_ENERGY;
15439 case UNIT_MOD_HAPPINESS:
15440 return POWER_HAPPINESS;
15441 case UNIT_MOD_RUNE:
15442 return POWER_RUNE;
15444 return POWER_RUNIC_POWER;
15445 default:
15446 case UNIT_MOD_MANA:
15447 return POWER_MANA;
15448 }
15449}
@ UNIT_MOD_RUNE
Definition Unit.h:154
@ UNIT_MOD_ENERGY
Definition Unit.h:152
@ UNIT_MOD_FOCUS
Definition Unit.h:151
@ UNIT_MOD_HAPPINESS
Definition Unit.h:153
@ UNIT_MOD_MANA
Definition Unit.h:149
@ UNIT_MOD_RAGE
Definition Unit.h:150
@ UNIT_MOD_RUNIC_POWER
Definition Unit.h:155

References POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RUNE, and UNIT_MOD_RUNIC_POWER.

Referenced by HandleStatModifier().

◆ GetPPMProcChance()

float Unit::GetPPMProcChance ( uint32  WeaponSpeed,
float  PPM,
SpellInfo const *  spellProto 
) const
13475{
13476 // proc per minute chance calculation
13477 if (PPM <= 0)
13478 return 0.0f;
13479
13480 // Apply chance modifer aura
13481 if (spellProto)
13482 if (Player* modOwner = GetSpellModOwner())
13483 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
13484
13485 return std::floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
13486}
@ SPELLMOD_PROC_PER_MINUTE
Definition SpellDefines.h:102

References GetSpellModOwner(), SpellInfo::Id, and SPELLMOD_PROC_PER_MINUTE.

Referenced by Player::CastItemCombatSpell(), and IsTriggeredAtSpellProcEvent().

◆ GetProcAurasTriggeredOnEvent()

void Unit::GetProcAurasTriggeredOnEvent ( std::list< AuraApplication * > &  aurasTriggeringProc,
std::list< AuraApplication * > *  procAuras,
ProcEventInfo  eventInfo 
)
16537{
16538 // use provided list of auras which can proc
16539 if (procAuras)
16540 {
16541 for (std::list<AuraApplication*>::iterator itr = procAuras->begin(); itr != procAuras->end(); ++itr)
16542 {
16543 ASSERT((*itr)->GetTarget() == this);
16544 if (!(*itr)->GetRemoveMode())
16545 if ((*itr)->GetBase()->IsProcTriggeredOnEvent(*itr, eventInfo))
16546 {
16547 (*itr)->GetBase()->PrepareProcToTrigger(*itr, eventInfo);
16548 aurasTriggeringProc.push_back(*itr);
16549 }
16550 }
16551 }
16552 // or generate one on our own
16553 else
16554 {
16555 for (AuraApplicationMap::iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
16556 {
16557 if (itr->second->GetBase()->IsProcTriggeredOnEvent(itr->second, eventInfo))
16558 {
16559 itr->second->GetBase()->PrepareProcToTrigger(itr->second, eventInfo);
16560 aurasTriggeringProc.push_back(itr->second);
16561 }
16562 }
16563 }
16564}

References ASSERT, and GetAppliedAuras().

Referenced by TriggerAurasProcOnEvent().

◆ getRace()

uint8 Unit::getRace ( bool  original = false) const
21030{
21031 if (IsPlayer())
21032 {
21033 if (original)
21034 return m_realRace;
21035 else
21036 return m_race;
21037 }
21038
21040}

References Object::GetByteValue(), Object::IsPlayer(), m_race, m_realRace, and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), Player::BuildPlayerRepop(), Corpse::BuildValuesUpdate(), Player::CreateCorpse(), GetModelForForm(), GetModelForTotem(), getRaceMask(), GetReactionTo(), Player::GetStartPosition(), Player::GetTeamId(), Player::GiveLevel(), WorldSession::HandleAlterAppearance(), AuraEffect::HandleAuraTransform(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Creature::IsValidTrainerForPlayer(), Channel::KickOrBan(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), RestoreFaction(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Player::SetGameMaster(), Player::StoreNewItemInBestSlots(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getRaceMask()

◆ GetRandomContactPoint()

bool Unit::GetRandomContactPoint ( Unit const *  target,
float &  x,
float &  y,
float &  z,
bool  force = false 
) const
701{
702 float combat_reach = GetCombatReach();
703 if (combat_reach < 0.1f) // sometimes bugged for players
704 combat_reach = DEFAULT_COMBAT_REACH;
705
706 uint32 attacker_number = getAttackers().size();
707 if (attacker_number > 0)
708 --attacker_number;
709 Creature const* c = obj->ToCreature();
710 if (c)
711 if (c->isWorldBoss() || c->IsDungeonBoss() || (obj->IsPet() && const_cast<Unit*>(obj)->ToPet()->isControlled()))
712 attacker_number = 0; // pussywizard: pets and bosses just come to target from their angle
713
714 GetNearPoint(obj, x, y, z, isMoving() ? (obj->GetCombatReach() > 7.75f ? obj->GetCombatReach() - 7.5f : 0.25f) : obj->GetCombatReach(), 0.0f,
715 GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI / 2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
716
717 // pussywizard
718 if (std::fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
719 {
720 x = this->GetPositionX();
721 y = this->GetPositionY();
722 z = this->GetPositionZ();
723 obj->UpdateAllowedPositionZ(x, y, z);
724 }
725 float maxDist = GetMeleeRange(obj);
726 if (GetExactDistSq(x, y, z) >= maxDist * maxDist)
727 {
728 if (force)
729 {
730 x = this->GetPositionX();
731 y = this->GetPositionY();
732 z = this->GetPositionZ();
733 return true;
734 }
735 return false;
736 }
737 return true;
738}
#define DEFAULT_COMBAT_REACH
Definition ObjectDefines.h:46
bool IsDungeonBoss() const
Definition Creature.cpp:3162
bool isControlled() const
Definition Pet.h:54
float GetCollisionHeight() const override
Return collision height sent to client.
Definition Unit.cpp:21129
float GetMeleeRange(Unit const *target) const
Definition Unit.cpp:679
bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
Definition Object.cpp:1337
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:169

References DEFAULT_COMBAT_REACH, Position::GetAngle(), getAttackers(), GetCollisionHeight(), GetCombatReach(), Position::GetExactDistSq(), GetMeleeRange(), WorldObject::GetNearPoint(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Pet::isControlled(), Creature::IsDungeonBoss(), isMoving(), IsPet(), WorldObject::IsWithinLOS(), Creature::isWorldBoss(), rand_norm(), Object::ToCreature(), ToPet(), and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_bug_trio::DamageTaken(), and boss_bug_trio::DoFinalSpell().

◆ GetRangedCritChanceReduction()

float Unit::GetRangedCritChanceReduction ( ) const
inline

◆ GetRangedCritDamageReduction()

uint32 Unit::GetRangedCritDamageReduction ( uint32  damage) const
inline

◆ GetRangedDamageReduction()

uint32 Unit::GetRangedDamageReduction ( uint32  damage) const
inline

◆ GetReactionTo()

ReputationRank Unit::GetReactionTo ( Unit const *  target,
bool  checkOriginalFaction = false 
) const
10088{
10089 // always friendly to self
10090 if (this == target)
10091 return REP_FRIENDLY;
10092
10093 // always friendly to charmer or owner
10095 return REP_FRIENDLY;
10096
10097 Player const* selfPlayerOwner = GetAffectingPlayer();
10098 Player const* targetPlayerOwner = target->GetAffectingPlayer();
10099
10100 // check forced reputation to support SPELL_AURA_FORCE_REACTION
10101 if (selfPlayerOwner)
10102 {
10103 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
10104 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
10105 return *repRank;
10106 }
10107 else if (targetPlayerOwner)
10108 {
10109 if (FactionTemplateEntry const* selfFactionTemplateEntry = GetFactionTemplateEntry())
10110 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(selfFactionTemplateEntry))
10111 return *repRank;
10112 }
10113
10115 {
10116 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
10117 {
10118 if (selfPlayerOwner && targetPlayerOwner)
10119 {
10120 // always friendly to other unit controlled by player, or to the player himself
10121 if (selfPlayerOwner == targetPlayerOwner)
10122 return REP_FRIENDLY;
10123
10124 // duel - always hostile to opponent
10125 if (selfPlayerOwner->duel && selfPlayerOwner->duel->Opponent == targetPlayerOwner && selfPlayerOwner->duel->State == DUEL_STATE_IN_PROGRESS)
10126 return REP_HOSTILE;
10127
10128 // same group - checks dependant only on our faction - skip FFA_PVP for example
10129 if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner))
10130 return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work
10131 // however client seems to allow mixed group parties, because in 13850 client it works like:
10132 // return GetFactionReactionTo(GetFactionTemplateEntry(), target);
10133 }
10134
10135 // check FFA_PVP
10136 if (IsFFAPvP() && target->IsFFAPvP())
10137 return REP_HOSTILE;
10138
10139 if (selfPlayerOwner)
10140 {
10141 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
10142 {
10143 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
10144 return *repRank;
10145 if (!selfPlayerOwner->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
10146 {
10147 if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction))
10148 {
10149 if (targetFactionEntry->CanHaveReputation())
10150 {
10151 // check contested flags
10152 if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
10153 && selfPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
10154 return REP_HOSTILE;
10155
10156 // if faction has reputation, hostile state depends only from AtWar state
10157 if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry))
10158 return REP_HOSTILE;
10159 return REP_FRIENDLY;
10160 }
10161 }
10162 }
10163 }
10164 }
10165 }
10166 }
10167
10168 ReputationRank repRank = REP_HATED;
10169 if (!sScriptMgr->IfNormalReaction(this, target, repRank))
10170 {
10171 return ReputationRank(repRank);
10172 }
10173
10174 FactionTemplateEntry const* factionTemplateEntry = nullptr;
10175 if (checkOriginalFaction)
10176 {
10177 if (IsPlayer())
10178 {
10179 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(getRace()))
10180 {
10181 factionTemplateEntry = sFactionTemplateStore.LookupEntry(rEntry->FactionID);
10182 }
10183 }
10184 else
10185 {
10186 Unit* owner = GetOwner();
10187 if (HasUnitTypeMask(UNIT_MASK_MINION) && owner)
10188 {
10189 factionTemplateEntry = sFactionTemplateStore.LookupEntry(owner->GetFaction());
10190 }
10191 else if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate())
10192 {
10193 factionTemplateEntry = sFactionTemplateStore.LookupEntry(cinfo->faction);
10194 }
10195 }
10196 }
10197
10198 if (!factionTemplateEntry)
10199 {
10200 factionTemplateEntry = GetFactionTemplateEntry();
10201 }
10202
10203 // do checks dependant only on our faction
10204 return GetFactionReactionTo(factionTemplateEntry, target);
10205}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
@ REP_HATED
Definition SharedDefines.h:180
bool HasPlayerFlag(PlayerFlags flags) const
Definition Player.h:1125
bool IsAtWar(uint32 faction_id) const
Definition ReputationMgr.cpp:55
ReputationRank GetFactionReactionTo(FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
Definition Unit.cpp:10207
bool IsInRaidWith(Unit const *unit) const
Definition Unit.cpp:18820
Definition DBCStructure.h:678

References Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), GetCharmerOrOwnerOrSelf(), GetFaction(), GetFactionReactionTo(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetOwner(), getRace(), Player::GetReputationMgr(), Player::HasPlayerFlag(), HasUnitFlag(), HasUnitFlag2(), HasUnitTypeMask(), ReputationMgr::IsAtWar(), IsFFAPvP(), IsInRaidWith(), Object::IsPlayer(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HATED, REP_HOSTILE, sChrRacesStore, sFactionStore, sFactionTemplateStore, sScriptMgr, Object::ToCreature(), UNIT_FLAG2_IGNORE_REPUTATION, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_MINION.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), Player::GetNPCIfCanInteractWith(), IsFriendlyTo(), IsHostileTo(), and Condition::Meets().

◆ GetRedirectThreatPercent()

uint32 Unit::GetRedirectThreatPercent ( )
inline
uint32 GetThreatPct() const
Definition ThreatMgr.h:299

References _redirectThreatInfo, and RedirectThreatInfo::GetThreatPct().

Referenced by ThreatMgr::DoAddThreat().

◆ GetRedirectThreatTarget()

Unit * Unit::GetRedirectThreatTarget ( ) const

◆ GetResistance() [1/2]

uint32 Unit::GetResistance ( SpellSchoolMask  mask) const
20357{
20358 int32 resist = -1;
20359 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
20360 if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
20361 resist = int32(GetResistance(SpellSchools(i)));
20362
20363 // resist value will never be negative here
20364 return uint32(resist);
20365}

References GetResistance(), MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

Referenced by Player::_SaveStats(), GetArmor(), GetEffectiveResistChance(), GetResistance(), and Player::outDebugValues().

◆ GetResistance() [2/2]

uint32 Unit::GetResistance ( SpellSchools  school) const
inline
1125{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_RESISTANCES) + school); }
@ UNIT_FIELD_RESISTANCES
Definition UpdateFields.h:156

References Object::GetUInt32Value(), and UNIT_FIELD_RESISTANCES.

◆ GetResistanceBuffMods()

float Unit::GetResistanceBuffMods ( SpellSchools  school,
bool  positive 
) const
inline

◆ GetShapeshiftForm()

◆ GetSharedVisionList()

◆ GetSheath()

SheathState Unit::GetSheath ( ) const
inline
SheathState
Definition UnitDefines.h:125

References Object::GetByteValue(), and UNIT_FIELD_BYTES_2.

◆ GetShieldBlockValue() [1/2]

virtual uint32 Unit::GetShieldBlockValue ( ) const
pure virtual

◆ GetShieldBlockValue() [2/2]

uint32 Unit::GetShieldBlockValue ( uint32  soft_cap,
uint32  hard_cap 
) const
inline
1104 {
1105 uint32 value = GetShieldBlockValue();
1106 if (value >= hard_cap)
1107 {
1108 value = (soft_cap + hard_cap) / 2;
1109 }
1110 else if (value > soft_cap)
1111 {
1112 value = soft_cap + ((value - soft_cap) / 2);
1113 }
1114
1115 return value;
1116 }

References GetShieldBlockValue().

◆ GetSingleCastAuras() [1/2]

AuraList & Unit::GetSingleCastAuras ( )
inline

◆ GetSingleCastAuras() [2/2]

AuraList const & Unit::GetSingleCastAuras ( ) const
inline
1357{ return m_scAuras; }

References m_scAuras.

◆ GetSpeed()

float Unit::GetSpeed ( UnitMoveType  mtype) const

◆ GetSpeedRate()

◆ GetSpellCritChanceReduction()

float Unit::GetSpellCritChanceReduction ( ) const
inline

◆ GetSpellCritDamageReduction()

◆ GetSpellDamageReduction()

uint32 Unit::GetSpellDamageReduction ( uint32  damage) const
inline

◆ GetSpellMaxRangeForTarget()

float Unit::GetSpellMaxRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
15171{
15172 if (!spellInfo->RangeEntry)
15173 {
15174 return 0;
15175 }
15176
15177 if (spellInfo->RangeEntry->RangeMax[1] == spellInfo->RangeEntry->RangeMax[0])
15178 {
15179 return spellInfo->GetMaxRange();
15180 }
15181
15182 if (!target)
15183 {
15184 return spellInfo->GetMaxRange(true);
15185 }
15186
15187 return spellInfo->GetMaxRange(!IsHostileTo(target));
15188}

References SpellInfo::GetMaxRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMax.

Referenced by spell_sha_fire_nova::CheckFireTotem(), Spell::CheckRange(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), ScriptedAI::SelectSpell(), GameObject::TriggeringLinkedGameObject(), and Pet::Update().

◆ GetSpellMinRangeForTarget()

float Unit::GetSpellMinRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
15191{
15192 if (!spellInfo->RangeEntry)
15193 {
15194 return 0;
15195 }
15196
15197 if (spellInfo->RangeEntry->RangeMin[1] == spellInfo->RangeEntry->RangeMin[0])
15198 {
15199 return spellInfo->GetMinRange();
15200 }
15201
15202 return spellInfo->GetMinRange(!IsHostileTo(target));
15203}

References SpellInfo::GetMinRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMin.

Referenced by Spell::CheckRange(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), and ScriptedAI::SelectSpell().

◆ GetSpellModOwner()

Player * Unit::GetSpellModOwner ( ) const
16601{
16602 if (Player* player = const_cast<Unit*>(this)->ToPlayer())
16603 {
16604 return player;
16605 }
16606
16607 if (Unit* owner = GetOwner())
16608 {
16609 if (Player* player = owner->ToPlayer())
16610 {
16611 return player;
16612 }
16613 }
16614
16615 // Special handling for Eye of Kilrogg
16617 {
16618 if (TempSummon const* tempSummon = ToTempSummon())
16619 {
16620 if (Unit* summoner = tempSummon->GetSummonerUnit())
16621 {
16622 return summoner->ToPlayer();
16623 }
16624 }
16625 }
16626
16627 return nullptr;
16628}
@ NPC_EYE_OF_KILROGG
Definition PetDefines.h:101
Definition TemporarySummon.h:40

References Object::GetEntry(), GetOwner(), NPC_EYE_OF_KILROGG, Object::ToPlayer(), and ToTempSummon().

Referenced by Spell::_cast(), Creature::AddSpellCooldown(), ApplyEffectModifiers(), CalcArmorReducedDamage(), SpellEffectInfo::CalcDamageMultiplier(), Aura::CalcDispelChance(), Aura::CalcMaxCharges(), Aura::CalcMaxDuration(), AuraEffect::CalcPeriodicCritChance(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), SpellEffectInfo::CalcRadius(), ThreatCalcHelper::calcThreat(), spell_dru_brambles_treant::CalculateAmount(), AuraEffect::CalculatePeriodic(), CalculateSpellDamageTaken(), SpellEffectInfo::CalcValueMultiplier(), Spell::cancel(), Spell::cast(), Spell::CheckRange(), Spell::CheckRuneCost(), Spell::EffectSummonPet(), Spell::EffectSummonType(), Spell::finish(), GetEffectiveResistChance(), SpellInfo::GetMaxRange(), GetPPMProcChance(), Spell::handle_delayed(), Spell::handle_immediate(), IsAlwaysDetectableFor(), SpellInfo::IsStrongerAuraActive(), IsTriggeredAtSpellProcEvent(), MagicSpellHitResult(), MeleeDamageBonusDone(), MeleeSpellMissChance(), ModSpellCastTime(), Spell::SelectImplicitChainTargets(), Aura::SetDuration(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), SpellHealingBonusDone(), SpellHealingBonusTaken(), Spell::SummonGuardian(), Spell::TakePower(), Spell::TakeRunePower(), Spell::UpdateChanneledTargetList(), and Aura::UpdateOwner().

◆ GetSpellSchoolByAuraGroup()

SpellSchools Unit::GetSpellSchoolByAuraGroup ( UnitMods  unitMod) const
15369{
15371
15372 switch (unitMod)
15373 {
15375 school = SPELL_SCHOOL_HOLY;
15376 break;
15378 school = SPELL_SCHOOL_FIRE;
15379 break;
15381 school = SPELL_SCHOOL_NATURE;
15382 break;
15384 school = SPELL_SCHOOL_FROST;
15385 break;
15387 school = SPELL_SCHOOL_SHADOW;
15388 break;
15390 school = SPELL_SCHOOL_ARCANE;
15391 break;
15392
15393 default:
15394 break;
15395 }
15396
15397 return school;
15398}
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:288
@ SPELL_SCHOOL_NATURE
Definition SharedDefines.h:286
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:287
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:289
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:285
@ SPELL_SCHOOL_HOLY
Definition SharedDefines.h:284
@ UNIT_MOD_RESISTANCE_SHADOW
Definition Unit.h:161
@ UNIT_MOD_RESISTANCE_FROST
Definition Unit.h:160
@ UNIT_MOD_RESISTANCE_HOLY
Definition Unit.h:157
@ UNIT_MOD_RESISTANCE_ARCANE
Definition Unit.h:162
@ UNIT_MOD_RESISTANCE_FIRE
Definition Unit.h:158
@ UNIT_MOD_RESISTANCE_NATURE
Definition Unit.h:159

References SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, and UNIT_MOD_RESISTANCE_SHADOW.

Referenced by HandleStatModifier().

◆ getStandState()

◆ GetStat()

◆ GetStatByAuraGroup()

Stats Unit::GetStatByAuraGroup ( UnitMods  unitMod) const
15401{
15402 Stats stat = STAT_STRENGTH;
15403
15404 switch (unitMod)
15405 {
15407 stat = STAT_STRENGTH;
15408 break;
15410 stat = STAT_AGILITY;
15411 break;
15413 stat = STAT_STAMINA;
15414 break;
15416 stat = STAT_INTELLECT;
15417 break;
15419 stat = STAT_SPIRIT;
15420 break;
15421
15422 default:
15423 break;
15424 }
15425
15426 return stat;
15427}
Stats
Definition SharedDefines.h:257
@ STAT_SPIRIT
Definition SharedDefines.h:262
@ STAT_INTELLECT
Definition SharedDefines.h:261
@ STAT_AGILITY
Definition SharedDefines.h:259
@ STAT_STRENGTH
Definition SharedDefines.h:258
@ STAT_STAMINA
Definition SharedDefines.h:260
@ UNIT_MOD_STAT_INTELLECT
Definition Unit.h:146
@ UNIT_MOD_STAT_SPIRIT
Definition Unit.h:147
@ UNIT_MOD_STAT_STRENGTH
Definition Unit.h:143
@ UNIT_MOD_STAT_AGILITY
Definition Unit.h:144
@ UNIT_MOD_STAT_STAMINA
Definition Unit.h:145

References STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by HandleStatModifier().

◆ GetTarget()

◆ GetThreatMgr() [1/2]

ThreatMgr & Unit::GetThreatMgr ( )
inline
909{ return m_ThreatMgr; }

References m_ThreatMgr.

Referenced by CreatureAI::_EnterEvadeMode(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_razorgore::boss_razorgoreAI::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_jindo::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_nethermancer_sepethrea::CanAIAttack(), boss_mor_grayhoof::CastRandomSpell(), CleanupBeforeRemoveFromMap(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), npc_magister_aledis::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), ScriptedAI::DoAddThreat(), UnitAI::DoCastToAllHostilePlayers(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoGetThreat(), ScriptedAI::DoModifyThreatByPercent(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), ScriptedAI::DoResetThreat(), ScriptedAI::DoResetThreatList(), Spell::EffectModifyThreatPercent(), Spell::EffectTaunt(), boss_faction_championsAI::EnemiesInRange(), boss_ragnaros::boss_ragnarosAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), boss_murmur::EnterEvadeMode(), boss_alar::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), TemporaryThreatModifierEvent::Execute(), StartMovementEvent::Execute(), boss_supremus::FindHatefulStrikeTarget(), npc_raging_flames::FixateRandomTarget(), SmartScript::GetTargets(), UnitAI::GetThreatMgr(), debug_commandscript::HandleDebugThreatListCommand(), spell_karazhan_blink::HandleDummy(), spell_kaelthas_mind_control::HandleEffect(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_enveloping_webs::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), HandleProcTriggerSpell(), PetAI::HandleReturnMovement(), spell_pursue::HandleScript(), spell_gurtogg_eject::HandleScriptEffect(), spell_leotheras_whirlwind::HandleScriptEffect(), boss_attumen::IsSummonedBy(), boss_blackheart_the_inciter::JustEngagedWith(), boss_jindo::JustSummoned(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), Creature::ModifyThreatPercentTemp(), boss_bug_trio::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), NonTankTargetSelector::operator()(), StoneGripTargetSelector::operator()(), boss_jeklik::PathEndReached(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_talon_king_ikiss::Reset(), boss_faction_championsAI::SelectEnemyCaster(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), SendChangeCurrentVictimOpcode(), SendThreatListUpdate(), setDeathState(), SetPhaseMask(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_ouro::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), BossAI::TeleportCheaters(), Creature::Update(), Update(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_nefarian::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), boss_taldaram::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), boss_netherspite::UpdatePortals(), and CreatureAI::UpdateVictim().

◆ GetThreatMgr() [2/2]

ThreatMgr const & Unit::GetThreatMgr ( ) const
inline
910{ return m_ThreatMgr; }

References m_ThreatMgr.

◆ GetTotalAttackPowerValue()

float Unit::GetTotalAttackPowerValue ( WeaponAttackType  attType,
Unit pVictim = nullptr 
) const
15452{
15453 if (attType == RANGED_ATTACK)
15454 {
15456 if (victim)
15457 ap += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
15458
15459 if (ap < 0)
15460 return 0.0f;
15462 }
15463 else
15464 {
15466 if (victim)
15467 ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
15468
15469 if (ap < 0)
15470 return 0.0f;
15472 }
15473}
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition SpellAuraDefines.h:190
@ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS
Definition SpellAuraDefines.h:228
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition UpdateFields.h:163
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition UpdateFields.h:165
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:167
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition UpdateFields.h:164
@ UNIT_FIELD_ATTACK_POWER
Definition UpdateFields.h:162
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition UpdateFields.h:166
int32 GetInt32Value(uint16 index) const
Definition Object.cpp:299

References Object::GetFloatValue(), Object::GetInt32Value(), GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, and UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER.

Referenced by spell_dk_ghoul_thrash::CalcDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_execute::HandleEffect(), spell_pal_seal_of_righteousness::HandleProc(), HandleProcTriggerSpell(), Spell::HandleThreatSpells(), Guardian::InitStatsForLevel(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellHealingBonusDone(), Guardian::UpdateDamagePhysical(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetTotalAuraModifier()

◆ GetTotalAuraModifierAreaExclusive()

int32 Unit::GetTotalAuraModifierAreaExclusive ( AuraType  auratype) const
5914{
5915 int32 modifier = 0;
5916 int32 areaModifier = 0;
5917
5918 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5919 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5920 {
5921 if ((*i)->GetSpellInfo()->HasAreaAuraEffect())
5922 {
5923 if (areaModifier < (*i)->GetAmount())
5924 areaModifier = (*i)->GetAmount();
5925 }
5926 else
5927 modifier += (*i)->GetAmount();
5928 }
5929
5930 return modifier + areaModifier;
5931}

References GetAuraEffectsByType().

Referenced by Player::UpdateSpellCritChance().

◆ GetTotalAuraModifierByAffectMask()

int32 Unit::GetTotalAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6090{
6091 int32 modifier = 0;
6092
6093 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6094 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6095 if ((*i)->IsAffectedOnSpell(affectedSpell))
6096 modifier += (*i)->GetAmount();
6097
6098 return modifier;
6099}

References GetAuraEffectsByType().

◆ GetTotalAuraModifierByMiscMask()

int32 Unit::GetTotalAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5985{
5986 int32 modifier = 0;
5987
5988 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5989 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5990 {
5991 if ((*i)->GetMiscValue()& misc_mask)
5992 modifier += (*i)->GetAmount();
5993 }
5994 return modifier;
5995}

References GetAuraEffectsByType().

Referenced by CalcArmorReducedDamage(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), GetEffectiveResistChance(), MagicSpellHitResult(), SpellCriticalDamageBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), and Player::UpdateSpellCritChance().

◆ GetTotalAuraModifierByMiscValue()

int32 Unit::GetTotalAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6038{
6039 int32 modifier = 0;
6040
6041 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6042 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6043 if ((*i)->GetMiscValue() == misc_value)
6044 modifier += (*i)->GetAmount();
6045
6046 return modifier;
6047}

References GetAuraEffectsByType().

Referenced by Player::CalculateReputationGain(), GetMechanicResistChance(), MeleeSpellHitResult(), ModSpellDuration(), Creature::Regenerate(), Player::Regenerate(), RollMeleeOutcomeAgainst(), and Player::UpdateManaRegen().

◆ GetTotalAuraModValue()

float Unit::GetTotalAuraModValue ( UnitMods  unitMod) const
15342{
15343 if (unitMod >= UNIT_MOD_END)
15344 {
15345 LOG_ERROR("entities.unit", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
15346 return 0.0f;
15347 }
15348
15349 if (m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
15350 return 0.0f;
15351
15352 float value = m_auraModifiersGroup[unitMod][BASE_VALUE];
15353 value *= m_auraModifiersGroup[unitMod][BASE_PCT];
15354 value += m_auraModifiersGroup[unitMod][TOTAL_VALUE];
15355 value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
15356
15357 return value;
15358}

References BASE_PCT, BASE_VALUE, LOG_ERROR, m_auraModifiersGroup, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_END.

Referenced by Creature::UpdateArmor(), Creature::UpdateMaxHealth(), Creature::UpdateMaxPower(), and Creature::UpdateResistances().

◆ GetTotalAuraMultiplier()

float Unit::GetTotalAuraMultiplier ( AuraType  auratype) const
5948{
5949 float multiplier = 1.0f;
5950
5951 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5952 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5953 AddPct(multiplier, (*i)->GetAmount());
5954
5955 return multiplier;
5956}

References AddPct(), and GetAuraEffectsByType().

Referenced by MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), SpellCriticalHealingBonus(), and UpdateSpeed().

◆ GetTotalAuraMultiplierByAffectMask()

float Unit::GetTotalAuraMultiplierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6102{
6103 float multiplier = 1.0f;
6104
6105 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6106 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6107 if ((*i)->IsAffectedOnSpell(affectedSpell))
6108 AddPct(multiplier, (*i)->GetAmount());
6109
6110 return multiplier;
6111}

References AddPct(), and GetAuraEffectsByType().

◆ GetTotalAuraMultiplierByMiscMask()

float Unit::GetTotalAuraMultiplierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5998{
5999 float multiplier = 1.0f;
6000
6001 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6002 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6003 if (((*i)->GetMiscValue() & misc_mask))
6004 AddPct(multiplier, (*i)->GetAmount());
6005
6006 return multiplier;
6007}

References AddPct(), and GetAuraEffectsByType().

Referenced by CalculateAOEDamageReduction(), CalculateMeleeDamage(), MeleeDamageBonusTaken(), and SpellCriticalHealingBonus().

◆ GetTotalAuraMultiplierByMiscValue()

float Unit::GetTotalAuraMultiplierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6050{
6051 float multiplier = 1.0f;
6052
6053 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6054 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6055 if ((*i)->GetMiscValue() == misc_value)
6056 AddPct(multiplier, (*i)->GetAmount());
6057
6058 return multiplier;
6059}

References AddPct(), and GetAuraEffectsByType().

Referenced by Player::UpdateManaRegen().

◆ GetTotalStatValue()

float Unit::GetTotalStatValue ( Stats  stat,
float  additionalValue = 0.0f 
) const
15326{
15327 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_STAT_START) + stat);
15328
15329 if (m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
15330 return 0.0f;
15331
15332 // value = ((base_value * base_pct) + total_value) * total_pct
15333 float value = m_auraModifiersGroup[unitMod][BASE_VALUE] + GetCreateStat(stat);
15334 value *= m_auraModifiersGroup[unitMod][BASE_PCT];
15335 value += m_auraModifiersGroup[unitMod][TOTAL_VALUE] + additionalValue;
15336 value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
15337
15338 return value;
15339}
UnitMods
Definition Unit.h:142
@ UNIT_MOD_STAT_START
Definition Unit.h:170
float GetCreateStat(Stats stat) const
Definition Unit.h:1006

References BASE_PCT, BASE_VALUE, GetCreateStat(), m_auraModifiersGroup, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_STAT_START.

Referenced by Player::UpdateAllStats(), Guardian::UpdateStats(), and Player::UpdateStats().

◆ getTransForm()

◆ GetTransGUID()

◆ GetUnitBlockChance()

float Unit::GetUnitBlockChance ( ) const
3703{
3704 if (Player const* player = ToPlayer())
3705 {
3706 if (player->CanBlock())
3707 {
3708 Item* tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
3709 if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block)
3711 }
3712 // is player but has no block ability or no not broken shield equipped
3713 return 0.0f;
3714 }
3715 else
3716 {
3717 if (ToCreature()->IsTotem())
3718 return 0.0f;
3719 else
3720 {
3721 float block = 5.0f;
3723 return block > 0.0f ? block : 0.0f;
3724 }
3725 }
3726}
@ EQUIPMENT_SLOT_OFFHAND
Definition Player.h:696
#define INVENTORY_SLOT_BAG_0
Definition Player.h:675
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition SpellAuraDefines.h:114
@ PLAYER_BLOCK_PERCENTAGE
Definition UpdateFields.h:346
bool IsBroken() const
Definition Item.h:257
uint32 Block
Definition ItemTemplate.h:674

References ItemTemplate::Block, EQUIPMENT_SLOT_OFFHAND, Object::GetFloatValue(), Item::GetTemplate(), GetTotalAuraModifier(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), IsTotem(), PLAYER_BLOCK_PERCENTAGE, SPELL_AURA_MOD_BLOCK_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitCriticalChance()

float Unit::GetUnitCriticalChance ( WeaponAttackType  attackType,
Unit const *  victim 
) const
3729{
3730 float crit;
3731
3732 if (IsPlayer())
3733 {
3734 switch (attackType)
3735 {
3736 case BASE_ATTACK:
3738 break;
3739 case OFF_ATTACK:
3741 break;
3742 case RANGED_ATTACK:
3744 break;
3745 // Just for good manner
3746 default:
3747 crit = 0.0f;
3748 break;
3749 }
3750 }
3751 else
3752 {
3753 crit = 5.0f;
3756 }
3757
3758 // flat aura mods
3759 if (attackType == RANGED_ATTACK)
3760 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE);
3761 else
3762 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
3763
3764 AuraEffectList const& mTotalAuraList = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
3765 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
3766 {
3767 if (GetGUID() != (*i)->GetCasterGUID())
3768 continue;
3769
3770 crit += (*i)->GetAmount();
3771 }
3772
3773 // reduce crit chance from Rating for players
3774 if (attackType != RANGED_ATTACK)
3775 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_MELEE);
3776 else
3777 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_RANGED);
3778
3779 // Apply crit chance from defence skill
3780 crit += (int32(GetMaxSkillValueForLevel(victim)) - int32(victim->GetDefenseSkillValue(this))) * 0.04f;
3781
3782 // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end
3783 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
3784
3785 if (crit < 0.0f)
3786 crit = 0.0f;
3787 return crit;
3788}
@ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER
Definition SpellAuraDefines.h:371
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE
Definition SpellAuraDefines.h:251
@ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
Definition SpellAuraDefines.h:260
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE
Definition SpellAuraDefines.h:250
@ SPELL_AURA_MOD_CRIT_PCT
Definition SpellAuraDefines.h:353
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition SpellAuraDefines.h:115
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition UpdateFields.h:351
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition UpdateFields.h:353
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition Unit.h:1136

References ApplyResilience(), BASE_ATTACK, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, GetAuraEffectsByType(), GetDefenseSkillValue(), Object::GetFloatValue(), Object::GetGUID(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), Object::IsPlayer(), OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_MOD_CRIT_PCT, and SPELL_AURA_MOD_WEAPON_CRIT_PERCENT.

Referenced by spell_dk_wandering_plague_aura::CheckProc(), and RollMeleeOutcomeAgainst().

◆ GetUnitDodgeChance()

float Unit::GetUnitDodgeChance ( ) const
3641{
3642 if (IsPlayer())
3643 return ToPlayer()->GetRealDodge(); //GetFloatValue(PLAYER_DODGE_PERCENTAGE);
3644 else
3645 {
3646 if (ToCreature()->IsTotem())
3647 return 0.0f;
3648 else
3649 {
3650 float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference)
3652 return dodge > 0.0f ? dodge : 0.0f;
3653 }
3654 }
3655}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition SpellAuraDefines.h:112
float GetRealDodge() const
Definition Player.h:2611

References Player::GetRealDodge(), GetTotalAuraModifier(), Object::IsPlayer(), IsTotem(), Creature::isWorldBoss(), SPELL_AURA_MOD_DODGE_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitFlags()

◆ GetUnitFlags2()

UnitFlags2 Unit::GetUnitFlags2 ( ) const
inline

Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.

UnitFlags2
Definition UnitDefines.h:287
@ UNIT_FIELD_FLAGS_2
Definition UpdateFields.h:118

References Object::GetUInt32Value(), and UNIT_FIELD_FLAGS_2.

Referenced by npc_commandscript::HandleNpcInfoCommand().

◆ GetUnitMeleeSkill()

uint32 Unit::GetUnitMeleeSkill ( Unit const *  target = nullptr) const
inline
1118{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }

References GetLevel(), and getLevelForTarget().

Referenced by DealMeleeDamage(), GetDefenseSkillValue(), and GetWeaponSkillValue().

◆ GetUnitMissChance()

float Unit::GetUnitMissChance ( WeaponAttackType  attType) const
3688{
3689 float miss_chance = 5.00f;
3690
3691 if (Player const* player = ToPlayer())
3692 miss_chance += player->GetMissPercentageFromDefence();
3693
3694 if (attType == RANGED_ATTACK)
3696 else
3698
3699 return miss_chance;
3700}
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
Definition SpellAuraDefines.h:247
@ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE
Definition SpellAuraDefines.h:248

References GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE, and Object::ToPlayer().

Referenced by MeleeSpellMissChance().

◆ GetUnitMovementFlags()

◆ GetUnitParryChance()

float Unit::GetUnitParryChance ( ) const
3658{
3659 float chance = 0.0f;
3660
3661 if (Player const* player = ToPlayer())
3662 {
3663 if (player->CanParry())
3664 {
3665 Item* tmpitem = player->GetWeaponForAttack(BASE_ATTACK, true);
3666 if (!tmpitem)
3667 tmpitem = player->GetWeaponForAttack(OFF_ATTACK, true);
3668
3669 if (tmpitem)
3670 chance = player->GetRealParry(); //GetFloatValue(PLAYER_PARRY_PERCENTAGE);
3671 }
3672 }
3673 else if (IsCreature())
3674 {
3675 if (ToCreature()->isWorldBoss())
3676 chance = 13.4f; // + 0.6 by skill diff
3678 chance = 5.0f;
3679
3680 // Xinef: if aura is present, type should not matter
3682 }
3683
3684 return chance > 0.0f ? chance : 0.0f;
3685}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition SpellAuraDefines.h:110

References BASE_ATTACK, CREATURE_TYPE_HUMANOID, GetCreatureType(), GetTotalAuraModifier(), Object::IsCreature(), OFF_ATTACK, SPELL_AURA_MOD_PARRY_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by spell_dk_spell_deflection::Absorb(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitState()

uint32 Unit::GetUnitState ( ) const
inline

◆ GetUnitTypeMask()

uint32 Unit::GetUnitTypeMask ( ) const
inline
714{ return m_unitTypeMask; }

References m_unitTypeMask.

◆ GetVehicle()

Vehicle * Unit::GetVehicle ( ) const
inline
1836{ return m_vehicle; }

References m_vehicle.

Referenced by KillRewarder::_InitXP(), Vehicle::AddPassenger(), WorldSession::BuildPartyMemberStatsChangedPacket(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::CanAIAttack(), npc_raging_spirit::npc_raging_spiritAI::CanAIAttack(), npc_icc_lk_checktarget::npc_icc_lk_checktargetAI::CanAIAttack(), boss_flame_leviathan_defense_turret::boss_flame_leviathan_defense_turretAI::CanAIAttack(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::CheckAchievementCriteriaMeet(), Spell::CheckCast(), Spell::EffectJumpDest(), Spell::EffectKnockBack(), CreatureAI::EnterEvadeMode(), GetDirectTransport(), SmartScript::GetTargets(), GetTransGUID(), WorldSession::HandleAttackSwingOpcode(), WorldSession::HandleChangeSeatsOnControlledVehicle(), spell_switch_infragreen_bomber_station::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), Player::IsPetNeedBeTemporaryUnsummoned(), npc_nexus_lord::npc_nexus_lordAI::JustDied(), npc_scion_of_eternity::npc_scion_of_eternityAI::JustDied(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), achievement_flame_leviathan_garage::OnCheck(), achievement_wg_didnt_stand_a_chance::OnCheck(), npc_announcer_toc5::OnGossipHello(), BattlefieldWG::OnPlayerLeaveWar(), boss_flame_leviathan_overload_device::boss_flame_leviathan_overload_deviceAI::OnSpellClick(), VehicleCheck::operator()(), OutDebugInfo(), Player::ProcessDelayedOperations(), Player::ProcessTerrainStatusUpdate(), Vehicle::RemovePassenger(), Creature::SelectVictim(), SetControlled(), Player::SetViewpoint(), lfg::LFGMgr::TeleportPlayer(), npc_pilgrims_bounty_chair::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdatePosition(), UpdateSpeed(), GameObject::Use(), Acore::MessageDistDeliverer::Visit(), and Acore::MessageDistDelivererToHostile::Visit().

◆ GetVehicleBase()

◆ GetVehicleCreatureBase()

◆ GetVehicleKit()

Vehicle * Unit::GetVehicleKit ( ) const
inline
1835{ return m_vehicleKit; }

References m_vehicleKit.

Referenced by _EnterVehicle(), Creature::AddToWorld(), Creature::AIM_Initialize(), boss_xt002::boss_xt002AI::AttachHeart(), npc_salvaged_siege_engine::BeforeSpellClick(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::boss_deathbringer_saurfangAI(), spell_igb_cannon_blast::CalculatePower(), Aura::CanStackWith(), spell_demolisher_ride_vehicle::CheckCast(), SmartAI::CheckConditions(), VehicleAI::CheckConditions(), Map::CreatureRelocation(), Dismount(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), npc_ulduar_vx001::npc_ulduar_vx001AI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), Spell::EffectTeleportUnits(), CreatureAI::EnterEvadeMode(), boss_ick::boss_ickAI::GetKrick(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::GetS3(), SmartScript::GetTargets(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraSetVehicle(), WorldSession::HandleCastSpellOpcode(), spell_q13280_13283_plant_battle_standard::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_q12919_gymers_throw::HandleScript(), HandleSpellClick(), IsOnVehicle(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), boss_gormok::boss_gormokAI::JustEngagedWith(), Mount(), npc_hover_disk::npc_hover_diskAI::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::MovementInform(), npc_vics_flying_machine::npc_vics_flying_machineAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::npc_high_overlord_saurfangAI(), npc_orb_carrier::npc_orb_carrierAI::npc_orb_carrierAI(), spell_systems_shutdown_aura::OnApply(), VehicleAI::OnCharmed(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), FlameLeviathanPursuedTargetSelector::operator()(), OutDebugInfo(), npc_wintergarde_gryphon::PassengerBoarded(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), Map::PlayerRelocation(), SmartScript::ProcessAction(), boss_skadi_grauf::boss_skadi_graufAI::RemoveSkadi(), Spell::SelectImplicitCasterObjectTargets(), SmartAI::SmartAI(), npc_wintergarde_gryphon::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_storm_cloud::npc_storm_cloudAI::SpellHit(), boss_flame_leviathan::boss_flame_leviathanAI::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), boss_gormok::boss_gormokAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_siege_machine::npc_wg_siege_machineAI::UpdateAI(), UpdateHeight(), and UpdateOrientation().

◆ GetVictim()

Unit * Unit::GetVictim ( ) const
inline
859{ return m_attacking; }

References m_attacking.

Referenced by boss_marli::_chargePlayer(), PetAI::_needToStop(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), PetAI::AttackedBy(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), boss_malygos::boss_malygosAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), Object::BuildMovementUpdate(), Creature::CallAssistance(), Creature::CallForHelp(), TurretAI::CanAIAttack(), PetAI::CanAttack(), boss_attumen::CanMeleeHit(), boss_midnight::CanMeleeHit(), boss_swamplord_muselek::CanShootVictim(), Spell::CheckCast(), boss_mandokir::boss_mandokirAI::DamageDealt(), boss_isalien::DamageTaken(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_leotheras_the_blind::DemonTime(), boss_sacrolash::DoAction(), boss_alythess::DoAction(), boss_skadi::boss_skadiAI::DoAction(), UnitAI::DoCast(), UnitAI::DoCastVictim(), ConfusedMovementGenerator< T >::DoFinalize(), Creature::DoFleeToGetAssistance(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), ScriptedAI::DoStopAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectTaunt(), boss_ouro::Emerge(), AssistDelayEvent::Execute(), RestoreAttack::Execute(), StartMovementEvent::Execute(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::ExecuteEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::ExecuteEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::ExecuteEvent(), emerald_dragonAI::ExecuteEvent(), spell_shazzrah_gate_dummy::FilterTargets(), spell_malchezaar_enfeeble::FilterTargets(), spell_chain_burn::FilterTargets(), spell_morogrim_tidewalker_watery_grave::FilterTargets(), TimedFleeingMovementGenerator::Finalize(), getAttackerForHelper(), ThreatMgr::GetCurrentVictim(), Player::GetInitialVisiblePackets(), CreatureGroup::GetNewTargetForMember(), SmartScript::GetTargets(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), cast_commandscript::HandleCastTargetCommad(), spell_aggro_drones::HandleDummy(), spell_gen_threshalisk_charge::HandleDummy(), HandleDummyAuraProc(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_lurker_below_spout::HandleEffectRemove(), AuraEffect::HandleModPossessPet(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandleSetRaidDifficultyOpcode(), ChaseMovementGenerator< T >::HasLostTarget(), Spell::InitExplicitTargets(), RotateMovementGenerator::Initialize(), IsMutualChase(), boss_ouro::IsPlayerWithinMeleeRange(), boss_attumen::IsSummonedBy(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), npc_malchezaar_axe::JustEngagedWith(), boss_shade_of_aran::JustEngagedWith(), boss_akilzon::JustEngagedWith(), boss_zuljin::JustEngagedWith(), npc_zealot_zath::JustEngagedWith(), npc_yor::JustEngagedWith(), npc_flame_of_azzinoth::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nethermancer_sepethrea::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), boss_sacrolash::JustEngagedWith(), boss_alythess::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), boss_vem::JustEngagedWith(), boss_veklor::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_midnight::JustSummoned(), boss_nightbane::JustSummoned(), boss_halazzi::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), npc_emily::npc_emilyAI::JustSummoned(), PetAI::KilledUnit(), boss_ick::boss_ickAI::KilledUnit(), boss_flame_leviathan::boss_flame_leviathanAI::KilledUnit(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderMoveTo(), CreatureGroup::MemberEngagingTarget(), SmartAI::MoveAway(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_kerlonian::npc_kerlonianAI::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_ringo::npc_ringoAI::MoveInLineOfSight(), boss_gluth::boss_gluthAI::MoveInLineOfSight(), npc_future_you::npc_future_youAI::MoveInLineOfSight(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), boss_nightbane::MovementInform(), boss_bug_trio::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), boss_felmyst::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_kagani_nightstrike::MovementInform(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), NecroticPlagueTargetCheck::operator()(), NonTankTargetSelector::operator()(), VampiricBiteTargetSelector::operator()(), BoneStormMoveTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), UnboundPlagueTargetSelector::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), boss_nefarian::PathEndReached(), SmartScript::ProcessEvent(), SmartScript::ProcessEventsFor(), SmartScript::ProcessTimedAction(), npc_mograine::npc_mograineAI::PullCathedral(), boss_grobbulus::boss_grobbulusAI::PullChamberAdds(), Creature::ReleaseFocus(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_pet_hunter_snake_trap::Reset(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), npc_thaladred::ScheduleEvents(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), npc_giant_claw_tentacle::ScheduleTasks(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), PetAI::SelectNextTarget(), UnitAI::SelectTargetList(), SmartAI::SetCombatMove(), SetConfused(), SetFeared(), SetStunned(), boss_murmur::ShouldCastResonance(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), npc_escortAI::Start(), FollowerAI::StartFollow(), StopAttackFaction(), SummonCroneIfReady(), boss_akilzon::SummonEagles(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_dorothee::SummonTito(), TauntApply(), TauntFadeOut(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Pet::Update(), Creature::Update(), Player::Update(), CasterAI::UpdateAI(), ArcherAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_general_angerforge::boss_general_angerforgeAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_broodlord::boss_broodlordAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), npc_twilight_summon::npc_twilight_summonAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), npc_crystalline_frayer::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::UpdateAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_watcher::npc_ulduar_dark_rune_watcherAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_xt002_pummeller::npc_xt002_pummellerAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), npc_azure_invader::npc_azure_invaderAI::UpdateAI(), npc_azure_raider::npc_azure_raiderAI::UpdateAI(), npc_azure_captain::npc_azure_captainAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_lady_malande::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), guard_shattrath_scryer::guard_shattrath_scryerAI::UpdateAI(), guard_shattrath_aldor::guard_shattrath_aldorAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), PossessedAI::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_zuljin_vortex::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), npc_pet_gen_gnomish_flame_turret::UpdateAI(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), Player::UpdateFFAPvPFlag(), Player::UpdateFFAPvPState(), SmartAI::UpdatePath(), boss_netherspite::UpdatePortals(), CreatureAI::UpdateVictim(), CreatureAI::UpdateVictimWithGaze(), and boss_hexlord_malacrass::UseAbility().

◆ GetVirtualItemId()

uint32 Unit::GetVirtualItemId ( uint32  slot) const
21191{
21192 if (slot >= MAX_EQUIPMENT_ITEMS)
21193 return 0;
21194
21196}
#define MAX_EQUIPMENT_ITEMS
Definition CreatureData.h:35
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition UpdateFields.h:116

References Object::GetUInt32Value(), MAX_EQUIPMENT_ITEMS, and UNIT_VIRTUAL_ITEM_SLOT_ID.

◆ GetVisibleAura()

AuraApplication * Unit::GetVisibleAura ( uint8  slot)
inline
1464 {
1465 VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
1466 if (itr != m_visibleAuras.end())
1467 return itr->second;
1468 return nullptr;
1469 }

References m_visibleAuras.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), AuraApplication::BuildUpdatePacket(), and WorldSession::HandleRequestPartyMemberStatsOpcode().

◆ GetVisibleAuras()

◆ GetWeaponDamageRange()

float Unit::GetWeaponDamageRange ( WeaponAttackType  attType,
WeaponDamageRange  type,
uint8  damageIndex = 0 
) const
15476{
15477 if (attType == OFF_ATTACK && !HasOffhandWeaponForAttack())
15478 return 0.0f;
15479
15480 return m_weaponDamage[attType][type][damageIndex];
15481}

References HasOffhandWeaponForAttack(), m_weaponDamage, and OFF_ATTACK.

Referenced by Player::_ApplyWeaponDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and Guardian::UpdateDamagePhysical().

◆ GetWeaponProcChance()

float Unit::GetWeaponProcChance ( ) const
13464{
13465 // normalized proc chance for weapon attack speed
13466 // (odd formula...)
13468 return (GetAttackTime(BASE_ATTACK) * 1.8f / 1000.0f);
13470 return (GetAttackTime(OFF_ATTACK) * 1.6f / 1000.0f);
13471 return 0;
13472}

References BASE_ATTACK, GetAttackTime(), HasOffhandWeaponForAttack(), isAttackReady(), and OFF_ATTACK.

Referenced by Player::CastItemCombatSpell().

◆ GetWeaponSkillValue()

uint32 Unit::GetWeaponSkillValue ( WeaponAttackType  attType,
Unit const *  target = nullptr 
) const
3791{
3792 uint32 value = 0;
3793 if (Player const* player = ToPlayer())
3794 {
3795 Item* item = player->GetWeaponForAttack(attType, true);
3796
3797 // feral or unarmed skill only for base attack
3798 if (attType != BASE_ATTACK && !item)
3799 return 0;
3800
3801 if (IsInFeralForm())
3802 return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
3803
3804 // weapon skill or (unarmed for base attack)
3805 uint32 skill = SKILL_UNARMED;
3806 if (item)
3807 skill = item->GetSkill();
3808
3809 // in PvP use full skill instead current skill value
3810 value = (target && target->IsControlledByPlayer())
3811 ? player->GetMaxSkillValue(skill)
3812 : player->GetSkillValue(skill);
3813 // Modify value from ratings
3814 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL));
3815 switch (attType)
3816 {
3817 case BASE_ATTACK:
3818 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_MAINHAND));
3819 break;
3820 case OFF_ATTACK:
3821 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_OFFHAND));
3822 break;
3823 case RANGED_ATTACK:
3824 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_RANGED));
3825 break;
3826 default:
3827 break;
3828 }
3829 }
3830 else
3831 value = GetUnitMeleeSkill(target);
3832 return value;
3833}
@ SKILL_UNARMED
Definition SharedDefines.h:2907
@ CR_WEAPON_SKILL_RANGED
Definition Unit.h:239
@ CR_WEAPON_SKILL
Definition Unit.h:217
@ CR_WEAPON_SKILL_OFFHAND
Definition Unit.h:238
@ CR_WEAPON_SKILL_MAINHAND
Definition Unit.h:237
uint32 GetSkill()
Definition Item.cpp:555
bool IsInFeralForm() const
Definition Unit.h:1873

References BASE_ATTACK, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, GetMaxSkillValueForLevel(), Item::GetSkill(), GetUnitMeleeSkill(), IsControlledByPlayer(), IsInFeralForm(), OFF_ATTACK, RANGED_ATTACK, SKILL_UNARMED, and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), RollMeleeOutcomeAgainst(), and Player::UpdateCritPercentage().

◆ HandleAuraProc()

bool Unit::HandleAuraProc ( Unit victim,
uint32  damage,
Aura triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
bool *  handled 
)
private
8763{
8764 SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
8765
8766 switch (dummySpell->SpellFamilyName)
8767 {
8769 switch (dummySpell->Id)
8770 {
8771 // Nevermelting Ice Crystal
8772 case 71564:
8773 RemoveAuraFromStack(71564);
8774 *handled = true;
8775 break;
8776 // Gaseous Bloat
8777 case 70672:
8778 case 72455:
8779 case 72832:
8780 case 72833:
8781 {
8782 if (Unit* caster = triggeredByAura->GetCaster())
8783 if (victim && caster->GetGUID() == victim->GetGUID())
8784 {
8785 *handled = true;
8786 uint32 stack = triggeredByAura->GetStackAmount();
8787 int32 const mod = (GetMap()->GetSpawnMode() & 1) ? 1500 : 1250;
8788 int32 dmg = 0;
8789 for (uint8 i = 1; i <= stack; ++i)
8790 dmg += mod * i;
8791 caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg);
8792 }
8793 break;
8794 }
8795 // Ball of Flames Proc
8796 case 71756:
8797 case 72782:
8798 case 72783:
8799 case 72784:
8800 RemoveAuraFromStack(dummySpell->Id);
8801 *handled = true;
8802 break;
8803 // Discerning Eye of the Beast
8804 case 59915:
8805 {
8806 CastSpell(this, 59914, true); // 59914 already has correct basepoints in DBC, no need for custom bp
8807 *handled = true;
8808 break;
8809 }
8810 // Swift Hand of Justice
8811 case 59906:
8812 {
8813 int32 bp0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
8814 CastCustomSpell(this, 59913, &bp0, nullptr, nullptr, true);
8815 *handled = true;
8816 break;
8817 }
8818 }
8819
8820 break;
8821 case SPELLFAMILY_MAGE:
8822 {
8823 // Combustion
8824 switch (dummySpell->Id)
8825 {
8826 case 11129:
8827 {
8828 *handled = true;
8829 Unit* caster = triggeredByAura->GetCaster();
8830 if (!caster || !damage)
8831 return false;
8832
8833 // last charge and crit
8834 if (triggeredByAura->GetCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT))
8835 return true; // charge counting (will removed)
8836
8837 CastSpell(this, 28682, true);
8838
8839 return procEx & PROC_EX_CRITICAL_HIT;
8840 }
8841 // Empowered Fire
8842 case 31656:
8843 case 31657:
8844 case 31658:
8845 {
8846 *handled = true;
8847
8848 SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(67545);
8849 if (!spInfo)
8850 return false;
8851
8852 int32 bp0 = int32(CalculatePct(GetMaxPower(POWER_MANA), spInfo->Effects[0].CalcValue()));
8853 CastCustomSpell(this, 67545, &bp0, nullptr, nullptr, true, nullptr, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
8854 return true;
8855 }
8856 }
8857 break;
8858 }
8860 {
8861 // Blood of the North
8862 // Reaping
8863 // Death Rune Mastery
8864 // xinef: Icon 22 is used for item bonus, skip
8865 if (dummySpell->SpellIconID == 3041 || (dummySpell->SpellIconID == 22 && dummySpell->Id != 62459) || dummySpell->SpellIconID == 2622)
8866 {
8867 *handled = true;
8868 // Convert recently used Blood Rune to Death Rune
8869 if (Player* player = ToPlayer())
8870 {
8871 if (!player->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
8872 return false;
8873
8874 // xinef: not true
8875 //RuneType rune = ToPlayer()->GetLastUsedRune();
8876 // can't proc from death rune use
8877 //if (rune == RUNE_DEATH)
8878 // return false;
8879 AuraEffect* aurEff = triggeredByAura->GetEffect(EFFECT_0);
8880 if (!aurEff)
8881 return false;
8882
8883 // Reset amplitude - set death rune remove timer to 30s
8884 aurEff->ResetPeriodic(true);
8885 uint32 runesLeft;
8886
8887 if (dummySpell->SpellIconID == 2622)
8888 runesLeft = 2;
8889 else
8890 runesLeft = 1;
8891
8892 for (uint8 i = 0; i < MAX_RUNES && runesLeft; ++i)
8893 {
8894 if (dummySpell->SpellIconID == 2622)
8895 {
8896 if (player->GetCurrentRune(i) == RUNE_DEATH ||
8897 player->GetBaseRune(i) == RUNE_BLOOD)
8898 continue;
8899 }
8900 else
8901 {
8902 if (player->GetCurrentRune(i) == RUNE_DEATH ||
8903 player->GetBaseRune(i) != RUNE_BLOOD)
8904 continue;
8905 }
8906 if (player->GetRuneCooldown(i) != player->GetRuneBaseCooldown(i, false))
8907 continue;
8908
8909 --runesLeft;
8910 // Mark aura as used
8911 player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
8912 }
8913 return true;
8914 }
8915 return false;
8916 }
8917 break;
8918 }
8920 {
8921 switch (dummySpell->Id)
8922 {
8923 // Item - Warrior T10 Protection 4P Bonus
8924 case 70844:
8925 {
8926 int32 basepoints0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
8927 CastCustomSpell(this, 70845, &basepoints0, nullptr, nullptr, true);
8928 break;
8929 }
8930 default:
8931 break;
8932 }
8933 break;
8934 }
8935 case SPELLFAMILY_SHAMAN:
8936 {
8937 // Flurry
8938 if ((dummySpell->SpellFamilyFlags[1] & 0x00000200) != 0)
8939 {
8940 if (cooldown)
8941 {
8942 if (HasSpellCooldown(dummySpell->Id))
8943 {
8944 *handled = true;
8945 break;
8946 }
8947
8948 AddSpellCooldown(dummySpell->Id, 0, cooldown);
8949 }
8950 }
8951 break;
8952 }
8953 }
8954 return false;
8955}
@ RUNE_DEATH
Definition Player.h:417
@ RUNE_BLOOD
Definition Player.h:414
@ EFFECT_1
Definition SharedDefines.h:32
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELLFAMILY_MAGE
Definition SharedDefines.h:3531
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3528
@ SPELLFAMILY_WARRIOR
Definition SharedDefines.h:3532
@ SPELLFAMILY_SHAMAN
Definition SharedDefines.h:3539
@ SPELLFAMILY_DEATHKNIGHT
Definition SharedDefines.h:3543
void ResetPeriodic(bool resetPeriodicTimer=false)
Definition SpellAuraEffects.h:89
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:175
uint8 GetSpawnMode() const
Definition Map.h:418
virtual bool HasSpellCooldown(uint32) const
Definition Unit.h:1266
virtual void AddSpellCooldown(uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition Unit.h:1268
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4925

References AddSpellCooldown(), CalculatePct(), CastCustomSpell(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, EFFECT_0, EFFECT_1, SpellInfo::Effects, Aura::GetCaster(), Aura::GetCharges(), Aura::GetEffect(), Object::GetGUID(), Object::GetGUID(), WorldObject::GetMap(), GetMaxHealth(), GetMaxPower(), Map::GetSpawnMode(), Aura::GetSpellInfo(), Aura::GetStackAmount(), HasSpellCooldown(), SpellInfo::Id, MAX_RUNES, POWER_MANA, PROC_EX_CRITICAL_HIT, RemoveAuraFromStack(), AuraEffect::ResetPeriodic(), RUNE_BLOOD, RUNE_DEATH, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_GENERIC, SPELLFAMILY_MAGE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SPELLVALUE_BASE_POINT0, sSpellMgr, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleAuraRaidProcFromCharge()

bool Unit::HandleAuraRaidProcFromCharge ( AuraEffect triggeredByAura)
private
17675{
17676 // aura can be deleted at casts
17677 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
17678
17679 uint32 damageSpellId;
17680 switch (spellProto->Id)
17681 {
17682 case 57949: // shiver
17683 damageSpellId = 57952;
17684 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
17685 break;
17686 case 59978: // shiver
17687 damageSpellId = 59979;
17688 break;
17689 case 43593: // Cold Stare
17690 damageSpellId = 43594;
17691 break;
17692 default:
17693 LOG_ERROR("entities.unit", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: {}", spellProto->Id);
17694 return false;
17695 }
17696
17697 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
17698
17699 // jumps
17700 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
17701
17702 // current aura expire
17703 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
17704
17705 // next target selection
17706 if (jumps > 0)
17707 {
17708 if (Unit* caster = triggeredByAura->GetCaster())
17709 {
17710 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
17711 if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
17712 {
17713 CastSpell(target, spellProto, true, nullptr, triggeredByAura, caster_guid);
17714 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
17715 aura->SetCharges(jumps);
17716 }
17717 }
17718 }
17719
17720 CastSpell(this, damageSpellId, true, nullptr, triggeredByAura, caster_guid);
17721
17722 return true;
17723}
void SetCharges(uint8 charges)
Definition SpellAuras.cpp:952
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition Unit.cpp:11137

References CastSpell(), SpellInfo::Effects, AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), GetNextRandomRaidMemberOrPet(), AuraEffect::GetSpellInfo(), SpellInfo::Id, LOG_ERROR, and Aura::SetCharges().

Referenced by ProcDamageAndSpellFor().

◆ HandleAuraRaidProcFromChargeWithValue()

bool Unit::HandleAuraRaidProcFromChargeWithValue ( AuraEffect triggeredByAura)
private
17586{
17587 // aura can be deleted at casts
17588 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
17589 int32 heal = triggeredByAura->GetAmount();
17590 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
17591
17592 // Currently only Prayer of Mending
17593 if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
17594 {
17595 LOG_DEBUG("spells.aura", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: {}", spellProto->Id);
17596 return false;
17597 }
17598
17599 // jumps
17600 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
17601
17602 // current aura expire
17603 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
17604
17605 // next target selection
17606 if (jumps > 0)
17607 {
17608 if (Unit* caster = triggeredByAura->GetCaster())
17609 {
17610 // smart healing
17611 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
17612 std::list<Unit*> nearMembers;
17613
17614 Player* player = nullptr;
17615 if (IsPlayer())
17616 player = ToPlayer();
17617 else if (GetOwner())
17618 player = GetOwner()->ToPlayer();
17619
17620 if (player)
17621 {
17622 Group* group = player->GetGroup();
17623 if (!group)
17624 {
17625 if (player != this)
17626 {
17627 if (IsWithinDistInMap(player, radius))
17628 nearMembers.push_back(player);
17629 }
17630 else if (Unit* pet = GetGuardianPet())
17631 {
17632 if (IsWithinDistInMap(pet, radius))
17633 nearMembers.push_back(pet);
17634 }
17635 }
17636 else
17637 {
17638 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
17639 if (Player* Target = itr->GetSource())
17640 {
17641 if (Target != this && !IsWithinDistInMap(Target, radius))
17642 continue;
17643
17644 // IsHostileTo check duel and controlled by enemy
17645 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
17646 nearMembers.push_back(Target);
17647
17648 // Push player's pet to vector
17649 if (Unit* pet = Target->GetGuardianPet())
17650 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
17651 nearMembers.push_back(pet);
17652 }
17653 }
17654
17655 if (!nearMembers.empty())
17656 {
17657 nearMembers.sort(Acore::HealthPctOrderPred());
17658 if (Unit* target = nearMembers.front())
17659 {
17660 CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
17661 CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, nullptr, triggeredByAura, caster_guid);
17662 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
17663 aura->SetCharges(jumps);
17664 }
17665 }
17666 }
17667 }
17668 }
17669
17670 // heal
17671 CastCustomSpell(this, 33110, &heal, nullptr, nullptr, true, nullptr, nullptr, caster_guid);
17672 return true;
17673}
@ SPELLFAMILY_PRIEST
Definition SharedDefines.h:3534
Definition Unit.h:2208

References CastCustomSpell(), CastSpell(), SpellInfo::Effects, AuraEffect::GetAmount(), AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), GetOwner(), AuraEffect::GetSpellInfo(), SpellInfo::Id, IsHostileTo(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, Aura::SetCharges(), SPELLFAMILY_PRIEST, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleDummyAuraProc()

bool Unit::HandleDummyAuraProc ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
ProcEventInfo const &  eventInfo 
)
private
Todo:
: It should be moved to database, shouldn't it?
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
Todo:
: need more info (cooldowns/PPM)
6613{
6614 SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
6615 uint32 effIndex = triggeredByAura->GetEffIndex();
6616 int32 triggerAmount = triggeredByAura->GetAmount();
6617 Spell const* spellProc = eventInfo.GetProcSpell();
6618
6619 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer()
6620 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
6621
6622 uint32 triggered_spell_id = 0;
6623 uint32 cooldown_spell_id = 0; // for random trigger, will be one of the triggered spell to avoid repeatable triggers
6624 // otherwise, it's the triggered_spell_id by default
6625 Unit* target = victim;
6626 int32 basepoints0 = 0;
6627 ObjectGuid originalCaster;
6628
6629 switch (dummySpell->SpellFamilyName)
6630 {
6632 {
6633 switch (dummySpell->Id)
6634 {
6635 // Overkill
6636 case 58426:
6637 {
6638 triggered_spell_id = 58427;
6639 break;
6640 }
6641 // Unstable Power
6642 case 24658:
6643 {
6644 if (!procSpell || procSpell->Id == 24659)
6645 return false;
6646 // Need remove one 24659 aura
6647 RemoveAuraFromStack(24659);
6648 return true;
6649 }
6650 // Restless Strength
6651 case 24661:
6652 {
6653 // Need remove one 24662 aura
6654 RemoveAuraFromStack(24662);
6655 return true;
6656 }
6657 // Mark of Malice
6658 case 33493:
6659 {
6660 if (triggeredByAura->GetBase()->GetCharges() > 1)
6661 return true;
6662
6663 target = this;
6664 triggered_spell_id = 33494;
6665 break;
6666 }
6667 // Twisted Reflection (boss spell)
6668 case 21063:
6669 triggered_spell_id = 21064;
6670 break;
6671 // Vampiric Aura (boss spell)
6672 case 38196:
6673 {
6674 basepoints0 = 3 * damage; // 300%
6675 if (basepoints0 < 0)
6676 return false;
6677
6678 triggered_spell_id = 31285;
6679 target = this;
6680 break;
6681 }
6682 // Aura of Madness (Darkmoon Card: Madness trinket)
6683 //=====================================================
6684 // 39511 Sociopath: +35 strength (Paladin, Rogue, Druid, Warrior)
6685 // 40997 Delusional: +70 attack power (Rogue, Hunter, Paladin, Warrior, Druid)
6686 // 40998 Kleptomania: +35 agility (Warrior, Rogue, Paladin, Hunter, Druid)
6687 // 40999 Megalomania: +41 damage/healing (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6688 // 41002 Paranoia: +35 spell/melee/ranged crit strike rating (All classes)
6689 // 41005 Manic: +35 haste (spell, melee and ranged) (All classes)
6690 // 41009 Narcissism: +35 intellect (Druid, Shaman, Priest, Warlock, Mage, Paladin, Hunter)
6691 // 41011 Martyr Complex: +35 stamina (All classes)
6692 // 41406 Dementia: Every 5 seconds either gives you +5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6693 // 41409 Dementia: Every 5 seconds either gives you -5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6694 case 39446:
6695 {
6696 if (!IsPlayer() || !IsAlive())
6697 return false;
6698
6699 // Select class defined buff
6700 switch (getClass())
6701 {
6702 case CLASS_PALADIN: // 39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409
6703 case CLASS_DRUID: // 39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409
6704 triggered_spell_id = RAND(39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409);
6705 cooldown_spell_id = 39511;
6706 break;
6707 case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011
6708 case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011
6709 case CLASS_DEATH_KNIGHT:
6710 triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011);
6711 cooldown_spell_id = 39511;
6712 break;
6713 case CLASS_PRIEST: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6714 case CLASS_SHAMAN: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6715 case CLASS_MAGE: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6716 case CLASS_WARLOCK: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6717 triggered_spell_id = RAND(40999, 41002, 41005, 41009, 41011, 41406, 41409);
6718 cooldown_spell_id = 40999;
6719 break;
6720 case CLASS_HUNTER: // 40997, 40999, 41002, 41005, 41009, 41011, 41406, 41409
6721 triggered_spell_id = RAND(40997, 40999, 41002, 41005, 41009, 41011, 41406, 41409);
6722 cooldown_spell_id = 40997;
6723 break;
6724 default:
6725 return false;
6726 }
6727
6728 target = this;
6729 if (roll_chance_i(10))
6730 ToPlayer()->Say("This is Madness!", LANG_UNIVERSAL);
6731 break;
6732 }
6733 // Sunwell Exalted Caster Neck (??? neck)
6734 // cast ??? Light's Wrath if Exalted by Aldor
6735 // cast ??? Arcane Bolt if Exalted by Scryers
6736 case 46569:
6737 return false; // old unused version
6738 // Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck)
6739 // cast 45479 Light's Wrath if Exalted by Aldor
6740 // cast 45429 Arcane Bolt if Exalted by Scryers
6741 case 45481:
6742 {
6743 Player* player = ToPlayer();
6744 if (!player)
6745 return false;
6746
6747 // Get Aldor reputation rank
6748 if (player->GetReputationRank(932) == REP_EXALTED)
6749 {
6750 target = this;
6751 triggered_spell_id = 45479;
6752 break;
6753 }
6754 // Get Scryers reputation rank
6755 if (player->GetReputationRank(934) == REP_EXALTED)
6756 {
6757 // triggered at positive/self casts also, current attack target used then
6758 if (target && IsFriendlyTo(target))
6759 {
6760 target = GetVictim();
6761 if (!target)
6762 {
6763 target = player->GetSelectedUnit();
6764 if (!target)
6765 return false;
6766 }
6767 if (IsFriendlyTo(target))
6768 return false;
6769 }
6770
6771 triggered_spell_id = 45429;
6772 break;
6773 }
6774 return false;
6775 }
6776 // Sunwell Exalted Melee Neck (Shattered Sun Pendant of Might neck)
6777 // cast 45480 Light's Strength if Exalted by Aldor
6778 // cast 45428 Arcane Strike if Exalted by Scryers
6779 case 45482:
6780 {
6781 if (!IsPlayer())
6782 return false;
6783
6784 // Get Aldor reputation rank
6785 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6786 {
6787 target = this;
6788 triggered_spell_id = 45480;
6789 break;
6790 }
6791 // Get Scryers reputation rank
6792 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6793 {
6794 triggered_spell_id = 45428;
6795 break;
6796 }
6797 return false;
6798 }
6799 // Sunwell Exalted Tank Neck (Shattered Sun Pendant of Resolve neck)
6800 // cast 45431 Arcane Insight if Exalted by Aldor
6801 // cast 45432 Light's Ward if Exalted by Scryers
6802 case 45483:
6803 {
6804 if (!IsPlayer())
6805 return false;
6806
6807 // Get Aldor reputation rank
6808 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6809 {
6810 target = this;
6811 triggered_spell_id = 45432;
6812 break;
6813 }
6814 // Get Scryers reputation rank
6815 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6816 {
6817 target = this;
6818 triggered_spell_id = 45431;
6819 break;
6820 }
6821 return false;
6822 }
6823 // Sunwell Exalted Healer Neck (Shattered Sun Pendant of Restoration neck)
6824 // cast 45478 Light's Salvation if Exalted by Aldor
6825 // cast 45430 Arcane Surge if Exalted by Scryers
6826 case 45484:
6827 {
6828 if (!IsPlayer())
6829 return false;
6830
6831 // Get Aldor reputation rank
6832 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6833 {
6834 target = this;
6835 triggered_spell_id = 45478;
6836 break;
6837 }
6838 // Get Scryers reputation rank
6839 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6840 {
6841 triggered_spell_id = 45430;
6842 break;
6843 }
6844 return false;
6845 }
6846 // Kill command
6847 case 58914:
6848 {
6849 // Remove aura stack from pet
6850 RemoveAuraFromStack(58914);
6851 Unit* owner = GetOwner();
6852 if (!owner)
6853 return true;
6854 // reduce the owner's aura stack
6855 owner->RemoveAuraFromStack(34027);
6856 return true;
6857 }
6858 // Vampiric Touch (generic, used by some boss)
6859 case 52723:
6860 case 60501:
6861 {
6862 triggered_spell_id = 52724;
6863 basepoints0 = damage / 2;
6864 target = this;
6865 break;
6866 }
6867 // Divine purpose
6868 case 31871:
6869 case 31872:
6870 {
6871 // Roll chane
6872 if (!victim || !victim->IsAlive() || !roll_chance_i(triggerAmount))
6873 return false;
6874
6875 // Remove any stun effect on target
6877 return true;
6878 }
6879 // Glyph of Life Tap
6880 case 63320:
6881 {
6882 triggered_spell_id = 63321; // Life Tap
6883 break;
6884 }
6885 case 71519: // Deathbringer's Will Normal
6886 {
6887 if (!IsPlayer() || HasSpellCooldown(71484))
6888 return false;
6889
6890 AddSpellCooldown(71484, 0, cooldown);
6891
6892 std::vector<uint32> RandomSpells;
6893 switch (getClass())
6894 {
6895 case CLASS_WARRIOR:
6896 case CLASS_PALADIN:
6897 case CLASS_DEATH_KNIGHT:
6898 RandomSpells.push_back(71484);
6899 RandomSpells.push_back(71491);
6900 RandomSpells.push_back(71492);
6901 break;
6902 case CLASS_SHAMAN:
6903 case CLASS_ROGUE:
6904 RandomSpells.push_back(71486);
6905 RandomSpells.push_back(71485);
6906 RandomSpells.push_back(71492);
6907 break;
6908 case CLASS_DRUID:
6909 RandomSpells.push_back(71484);
6910 RandomSpells.push_back(71485);
6911 RandomSpells.push_back(71492);
6912 break;
6913 case CLASS_HUNTER:
6914 RandomSpells.push_back(71486);
6915 RandomSpells.push_back(71491);
6916 RandomSpells.push_back(71485);
6917 break;
6918 default:
6919 return false;
6920 }
6921 if (RandomSpells.empty()) // shouldn't happen
6922 return false;
6923
6924 uint8 rand_spell = irand(0, (RandomSpells.size() - 1));
6925 CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster);
6926 break;
6927 }
6928 case 71562: // Deathbringer's Will Heroic
6929 {
6930 if (!IsPlayer() || HasSpellCooldown(71561))
6931 return false;
6932
6933 AddSpellCooldown(71561, 0, cooldown);
6934
6935 std::vector<uint32> RandomSpells;
6936 switch (getClass())
6937 {
6938 case CLASS_WARRIOR:
6939 case CLASS_PALADIN:
6940 case CLASS_DEATH_KNIGHT:
6941 RandomSpells.push_back(71561);
6942 RandomSpells.push_back(71559);
6943 RandomSpells.push_back(71560);
6944 break;
6945 case CLASS_SHAMAN:
6946 case CLASS_ROGUE:
6947 RandomSpells.push_back(71558);
6948 RandomSpells.push_back(71556);
6949 RandomSpells.push_back(71560);
6950 break;
6951 case CLASS_DRUID:
6952 RandomSpells.push_back(71561);
6953 RandomSpells.push_back(71556);
6954 RandomSpells.push_back(71560);
6955 break;
6956 case CLASS_HUNTER:
6957 RandomSpells.push_back(71558);
6958 RandomSpells.push_back(71559);
6959 RandomSpells.push_back(71556);
6960 break;
6961 default:
6962 return false;
6963 }
6964 if (RandomSpells.empty()) // shouldn't happen
6965 return false;
6966
6967 uint8 rand_spell = irand(0, (RandomSpells.size() - 1));
6968 CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster);
6969 break;
6970 }
6971 // Freya, Petrified Bark
6972 case 62933:
6973 case 62337:
6974 {
6975 if (!victim)
6976 return false;
6977
6978 int32 dmg = damage;
6979 victim->CastCustomSpell(this, 62379, &dmg, 0, 0, true);
6980 return true;
6981 }
6982 // Trial of the Champion, Earth Shield
6983 case 67534:
6984 {
6985 const int32 dmg = (int32)damage;
6986 CastCustomSpell(this, 67535, &dmg, nullptr, nullptr, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID());
6987 return true;
6988 }
6989 // Trial of the Crusader, Faction Champions, Retaliation
6990 case 65932:
6991 {
6992 // check attack comes not from behind
6993 if (!victim || !HasInArc(M_PI, victim))
6994 return false;
6995
6996 triggered_spell_id = 65934;
6997 break;
6998 }
6999 // Pit of Saron, Tyrannus, Overlord's Brand
7000 case 69172: // everything except for DoTs
7001 {
7002 if (!target)
7003 return false;
7004 if (Unit* caster = triggeredByAura->GetCaster())
7005 {
7007 {
7008 int32 dmg = 5.5f * damage;
7009 target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true);
7010 }
7011 else
7012 {
7013 if (caster->GetVictim())
7014 {
7015 int32 dmg = damage;
7016 target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true);
7017 }
7018 }
7019 }
7020 return true;
7021 }
7022 // Pit of Saron, Tyrannus, Overlord's Brand
7023 case 69173: // only DoTs
7024 {
7025 if (!target)
7026 return false;
7027 if (Unit* caster = triggeredByAura->GetCaster())
7028 {
7029 if (procEx & PROC_EX_INTERNAL_HOT)
7030 {
7031 int32 dmg = 5.5f * damage;
7032 target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true);
7033 }
7034 else
7035 {
7036 if (caster->GetVictim())
7037 {
7038 int32 dmg = damage;
7039 target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true);
7040 }
7041 }
7042 }
7043 return true;
7044 }
7045 // Icecrown Citadel, Lady Deathwhisper, Vampiric Might
7046 case 70674:
7047 {
7048 if (Unit* caster = triggeredByAura->GetCaster())
7049 {
7050 int32 dmg = 3 * damage;
7051 caster->CastCustomSpell(caster, 70677, &dmg, 0, 0, true);
7052 }
7053 return true;
7054 }
7055 // Item: Purified Shard of the Gods
7056 case 69755:
7057 {
7058 triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69733 : 69729);
7059 break;
7060 }
7061 // Item: Shiny Shard of the Gods
7062 case 69739:
7063 {
7064 triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69734 : 69730);
7065 break;
7066 }
7067 // VoA: Meteor Fists koralon
7068 case 66725:
7069 case 68161:
7070 {
7071 triggered_spell_id = 66765; // handled by spell_difficulty
7072 break;
7073 }
7074 }
7075 break;
7076 }
7077 case SPELLFAMILY_MAGE:
7078 {
7079 // Magic Absorption
7080 if (dummySpell->SpellIconID == 459) // only this spell has SpellIconID == 459 and dummy aura
7081 {
7083 return false;
7084
7085 // mana reward
7086 basepoints0 = CalculatePct(int32(GetMaxPower(POWER_MANA)), triggerAmount);
7087 target = this;
7088 triggered_spell_id = 29442;
7089 break;
7090 }
7091 // Hot Streak
7092 if (dummySpell->SpellIconID == 2999)
7093 {
7094 if (effIndex != 0)
7095 return false;
7096 AuraEffect* counter = triggeredByAura->GetBase()->GetEffect(EFFECT_1);
7097 if (!counter)
7098 return true;
7099
7100 // Count spell criticals in a row in second aura
7101 if (procEx & PROC_EX_CRITICAL_HIT)
7102 {
7103 counter->SetAmount(counter->GetAmount() * 2);
7104 if (counter->GetAmount() < 100) // not enough
7105 return true;
7106 // Crititcal counted -> roll chance
7107 if (roll_chance_i(triggerAmount))
7108 CastSpell(this, 48108, true, castItem, triggeredByAura);
7109 }
7110 counter->SetAmount(25);
7111 return true;
7112 }
7113 // Incanter's Regalia set (add trigger chance to Mana Shield)
7114 if (dummySpell->SpellFamilyFlags[0] & 0x8000)
7115 {
7116 if (!IsPlayer())
7117 return false;
7118
7119 target = this;
7120 triggered_spell_id = 37436;
7121 break;
7122 }
7123 switch (dummySpell->Id)
7124 {
7125 // Glyph of Polymorph
7126 case 56375:
7127 {
7128 if (!target)
7129 return false;
7130 target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
7133 return true;
7134 }
7135 // Glyph of Icy Veins
7136 case 56374:
7137 {
7140 return true;
7141 }
7142 // Glyph of Ice Block
7143 case 56372:
7144 {
7145 Player* player = ToPlayer();
7146 if (!player)
7147 return false;
7148
7149 SpellCooldowns const cooldowns = player->GetSpellCooldowns();
7150 // remove cooldowns on all ranks of Frost Nova
7151 for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
7152 {
7153 SpellInfo const* cdSpell = sSpellMgr->GetSpellInfo(itr->first);
7154 // Frost Nova
7155 if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
7156 && cdSpell->SpellFamilyFlags[0] & 0x00000040)
7157 player->RemoveSpellCooldown(cdSpell->Id, true);
7158 }
7159 break;
7160 }
7161 }
7162 break;
7163 }
7165 {
7166 switch (dummySpell->Id)
7167 {
7168 // Victorious
7169 case 32216:
7170 {
7171 RemoveAura(dummySpell->Id);
7172 return false;
7173 }
7174 }
7175
7176 // Second Wind
7177 if (dummySpell->SpellIconID == 1697)
7178 {
7179 // only for spells and hit/crit (trigger start always) and not start from self casted spells (5530 Mace Stun Effect for example)
7180 if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
7181 return false;
7182 // Need stun or root mechanic
7183 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN))))
7184 return false;
7185
7186 switch (dummySpell->Id)
7187 {
7188 case 29838:
7189 triggered_spell_id = 29842;
7190 break;
7191 case 29834:
7192 triggered_spell_id = 29841;
7193 break;
7194 case 42770:
7195 triggered_spell_id = 42771;
7196 break;
7197 default:
7198 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled spell id: {} (SW)", dummySpell->Id);
7199 return false;
7200 }
7201
7202 target = this;
7203 break;
7204 }
7205 break;
7206 }
7208 {
7209 switch (dummySpell->Id)
7210 {
7211 // Nightfall
7212 case 18094:
7213 case 18095:
7214 // Glyph of corruption
7215 case 56218:
7216 {
7217 target = this;
7218 triggered_spell_id = 17941;
7219 break;
7220 }
7221 // Soul Leech
7222 case 30293:
7223 case 30295:
7224 case 30296:
7225 {
7226 // Improved Soul Leech
7227 AuraEffectList const& SoulLeechAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
7228 for (Unit::AuraEffectList::const_iterator i = SoulLeechAuras.begin(); i != SoulLeechAuras.end(); ++i)
7229 {
7230 if ((*i)->GetId() == 54117 || (*i)->GetId() == 54118)
7231 {
7232 if ((*i)->GetEffIndex() != 0)
7233 continue;
7234 basepoints0 = int32((*i)->GetAmount());
7235 target = GetGuardianPet();
7236 if (target)
7237 {
7238 // regen mana for pet
7239 CastCustomSpell(target, 54607, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
7240 }
7241 // regen mana for caster
7242 CastCustomSpell(this, 59117, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
7243 // Get second aura of spell for replenishment effect on party
7244 if (AuraEffect const* aurEff = (*i)->GetBase()->GetEffect(EFFECT_1))
7245 {
7246 // Replenishment - roll chance
7247 if (roll_chance_i(aurEff->GetAmount()))
7248 {
7249 CastSpell(this, 57669, true, castItem, triggeredByAura);
7250 }
7251 }
7252 break;
7253 }
7254 }
7255 // health
7256 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7257 target = this;
7258 triggered_spell_id = 30294;
7259 break;
7260 }
7261 // Shadowflame (Voidheart Raiment set bonus)
7262 case 37377:
7263 {
7264 triggered_spell_id = 37379;
7265 break;
7266 }
7267 // Pet Healing (Corruptor Raiment or Rift Stalker Armor)
7268 case 37381:
7269 {
7270 target = GetGuardianPet();
7271 if (!target)
7272 return false;
7273
7274 // heal amount
7275 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7276 triggered_spell_id = 37382;
7277 break;
7278 }
7279 // Shadowflame Hellfire (Voidheart Raiment set bonus)
7280 case 39437:
7281 {
7282 triggered_spell_id = 37378;
7283 break;
7284 }
7285 }
7286 break;
7287 }
7288 case SPELLFAMILY_PRIEST:
7289 {
7290 // Body and Soul
7291 if (dummySpell->SpellIconID == 2218)
7292 {
7293 // Proc only from Abolish desease on self cast
7294 if (procSpell->Id != 552 || victim != this || !roll_chance_i(triggerAmount))
7295 return false;
7296 triggered_spell_id = 64136;
7297 target = this;
7298 break;
7299 }
7300 switch (dummySpell->Id)
7301 {
7302 // Vampiric Embrace
7303 case 15286:
7304 {
7305 if (!victim || !victim->IsAlive() || procSpell->SpellFamilyFlags[1] & 0x80000)
7306 return false;
7307
7308 // heal amount
7309 int32 total = CalculatePct(int32(damage), triggerAmount);
7310 int32 team = total / 5;
7311 int32 self = total - team;
7312 CastCustomSpell(this, 15290, &team, &self, nullptr, true, castItem, triggeredByAura);
7313 return true; // no hidden cooldown
7314 }
7315 // Priest Tier 6 Trinket (Ashtongue Talisman of Acumen)
7316 case 40438:
7317 {
7318 // Shadow Word: Pain
7319 if (procSpell->SpellFamilyFlags[0] & 0x8000)
7320 triggered_spell_id = 40441;
7321 // Renew
7322 else if (procSpell->SpellFamilyFlags[0] & 0x40)
7323 triggered_spell_id = 40440;
7324 else
7325 return false;
7326
7327 target = this;
7328 break;
7329 }
7330 // Improved Shadowform
7331 case 47570:
7332 case 47569:
7333 {
7334 if (!roll_chance_i(triggerAmount))
7335 return false;
7336
7338 break;
7339 }
7340 // Glyph of Dispel Magic
7341 case 55677:
7342 {
7343 // Dispel Magic shares spellfamilyflag with abolish disease
7344 if (procSpell->SpellIconID != 74)
7345 return false;
7346 if (!target || !target->IsFriendlyTo(this))
7347 return false;
7348
7349 basepoints0 = int32(target->CountPctFromMaxHealth(triggerAmount));
7350 triggered_spell_id = 56131;
7351 break;
7352 }
7353 // Oracle Healing Bonus ("Garments of the Oracle" set)
7354 case 26169:
7355 {
7356 // heal amount
7357 basepoints0 = int32(CalculatePct(damage, 10));
7358 target = this;
7359 triggered_spell_id = 26170;
7360 break;
7361 }
7362 // Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
7363 case 39372:
7364 {
7365 if (!procSpell || (procSpell->GetSchoolMask() & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW)) == 0)
7366 return false;
7367
7368 // heal amount
7369 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7370 target = this;
7371 triggered_spell_id = 39373;
7372 break;
7373 }
7374 // Greater Heal (Vestments of Faith (Priest Tier 3) - 4 pieces bonus)
7375 case 28809:
7376 {
7377 triggered_spell_id = 28810;
7378 break;
7379 }
7380 // Priest T10 Healer 2P Bonus
7381 case 70770:
7382 // Flash Heal
7383 if (procSpell->SpellFamilyFlags[0] & 0x800)
7384 {
7385 triggered_spell_id = 70772;
7386 SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
7387 if (!blessHealing || !victim)
7388 return false;
7389 basepoints0 = int32(CalculatePct(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
7390 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0);
7391 return true;
7392 }
7393 break;
7394 }
7395 break;
7396 }
7397 case SPELLFAMILY_DRUID:
7398 {
7399 switch (dummySpell->Id)
7400 {
7401 // Glyph of Innervate
7402 case 54832:
7403 {
7404 if (procSpell->SpellIconID != 62)
7405 return false;
7406
7407 int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
7408 basepoints0 = int32(CalculatePct(GetCreatePowers(POWER_MANA), mana_perc) / 10);
7409 triggered_spell_id = 54833;
7410 target = this;
7411 break;
7412 }
7413 // Glyph of Starfire
7414 case 54845:
7415 {
7416 triggered_spell_id = 54846;
7417 break;
7418 }
7419 // Glyph of Shred
7420 case 54815:
7421 {
7422 if (!target)
7423 return false;
7424
7425 // try to find spell Rip on the target
7426 if (AuraEffect const* AurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, GetGUID()))
7427 {
7428 // Rip's max duration, note: spells which modifies Rip's duration also counted like Glyph of Rip
7429 uint32 CountMin = AurEff->GetBase()->GetMaxDuration();
7430
7431 // just Rip's max duration without other spells
7432 uint32 CountMax = AurEff->GetSpellInfo()->GetMaxDuration();
7433
7434 // add possible auras' and Glyph of Shred's max duration
7435 CountMax += 3 * triggerAmount * IN_MILLISECONDS; // Glyph of Shred -> +6 seconds
7436 CountMax += HasAura(54818) ? 4 * IN_MILLISECONDS : 0; // Glyph of Rip -> +4 seconds
7437 CountMax += HasAura(60141) ? 4 * IN_MILLISECONDS : 0; // Rip Duration/Lacerate Damage -> +4 seconds
7438
7439 // if min < max -> that means caster didn't cast 3 shred yet
7440 // so set Rip's duration and max duration
7441 if (CountMin < CountMax)
7442 {
7443 AurEff->GetBase()->SetDuration(AurEff->GetBase()->GetDuration() + triggerAmount * IN_MILLISECONDS);
7444 AurEff->GetBase()->SetMaxDuration(CountMin + triggerAmount * IN_MILLISECONDS);
7445 return true;
7446 }
7447 }
7448 // if not found Rip
7449 return false;
7450 }
7451 // Glyph of Rake
7452 case 54821:
7453 {
7454 if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
7455 {
7456 if (target && target->IsCreature())
7457 {
7458 triggered_spell_id = 54820;
7459 break;
7460 }
7461 }
7462 return false;
7463 }
7464 // Leader of the Pack
7465 case 24932:
7466 {
7467 if (triggerAmount <= 0)
7468 return false;
7469 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
7470 target = this;
7471 triggered_spell_id = 34299;
7472 if (triggeredByAura->GetCasterGUID() != GetGUID())
7473 break;
7474 int32 basepoints1 = CalculatePct(GetMaxPower(Powers(POWER_MANA)), triggerAmount * 2);
7475 // Improved Leader of the Pack
7476 // Check cooldown of heal spell cooldown
7477 if (IsPlayer() && !ToPlayer()->HasSpellCooldown(34299))
7478 CastCustomSpell(this, 68285, &basepoints1, 0, 0, true, 0, triggeredByAura);
7479 break;
7480 }
7481 // Healing Touch (Dreamwalker Raiment set)
7482 case 28719:
7483 {
7484 // mana back
7485 basepoints0 = int32(CalculatePct(spellProc->GetPowerCost(), 30));
7486 target = this;
7487 triggered_spell_id = 28742;
7488 break;
7489 }
7490 // Glyph of Rejuvenation
7491 case 54754:
7492 {
7493 if (!victim || !victim->HealthBelowPct(uint32(triggerAmount)))
7494 return false;
7495 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7496 triggered_spell_id = 54755;
7497 break;
7498 }
7499 // Healing Touch Refund (Idol of Longevity trinket)
7500 case 28847:
7501 {
7502 target = this;
7503 triggered_spell_id = 28848;
7504 break;
7505 }
7506 // Mana Restore (Malorne Raiment set / Malorne Regalia set)
7507 case 37288:
7508 case 37295:
7509 {
7510 target = this;
7511 triggered_spell_id = 37238;
7512 break;
7513 }
7514 // Druid Tier 6 Trinket
7515 case 40442:
7516 {
7517 float chance;
7518
7519 // Starfire
7520 if (procSpell->SpellFamilyFlags[0] & 0x4)
7521 {
7522 triggered_spell_id = 40445;
7523 chance = 25.0f;
7524 }
7525 // Rejuvenation
7526 else if (procSpell->SpellFamilyFlags[0] & 0x10)
7527 {
7528 triggered_spell_id = 40446;
7529 chance = 25.0f;
7530 }
7531 // Mangle (Bear) and Mangle (Cat)
7532 else if (procSpell->SpellFamilyFlags[1] & 0x00000440)
7533 {
7534 triggered_spell_id = 40452;
7535 chance = 40.0f;
7536 }
7537 else
7538 return false;
7539
7540 if (!roll_chance_f(chance))
7541 return false;
7542
7543 target = this;
7544 break;
7545 }
7546 // Maim Interrupt
7547 case 44835:
7548 {
7549 // Deadly Interrupt Effect
7550 triggered_spell_id = 32747;
7551 break;
7552 }
7553 // Item - Druid T10 Restoration 4P Bonus (Rejuvenation)
7554 case 70664:
7555 {
7556 // xinef: proc only from normal Rejuvenation, and proc rejuvenation
7557 if (!victim || !procSpell || procSpell->SpellIconID != 64)
7558 return false;
7559
7560 Player* caster = ToPlayer();
7561 if (!caster)
7562 return false;
7563 if (!caster->GetGroup() && victim == this)
7564 return false;
7565
7566 CastCustomSpell(70691, SPELLVALUE_BASE_POINT0, damage, victim, true);
7567 return true;
7568 }
7569 }
7570 // Eclipse
7571 if (dummySpell->SpellIconID == 2856 && IsPlayer())
7572 {
7573 if (!procSpell || effIndex != 0)
7574 return false;
7575
7576 bool isWrathSpell = (procSpell->SpellFamilyFlags[0] & 1);
7577
7578 if (!roll_chance_f(dummySpell->ProcChance * (isWrathSpell ? 0.6f : 1.0f)))
7579 return false;
7580
7581 target = this;
7582 if (target->HasAura(isWrathSpell ? 48517 : 48518))
7583 return false;
7584
7585 triggered_spell_id = isWrathSpell ? 48518 : 48517;
7586 break;
7587 }
7588 [[fallthrough]];
7589 }
7590 case SPELLFAMILY_ROGUE:
7591 {
7592 switch (dummySpell->Id)
7593 {
7594 // Glyph of Backstab
7595 case 56800:
7596 {
7597 if (victim)
7598 if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID()))
7599 if (Aura* aur = aurEff->GetBase())
7600 if (!aur->IsRemoved() && aur->GetDuration() > 0)
7601 if ((aur->GetApplyTime() + aur->GetMaxDuration() / 1000 + 5) > (GameTime::GetGameTime().count() + aur->GetDuration() / 1000))
7602 {
7603 aur->SetDuration(aur->GetDuration() + 2000);
7604 return true;
7605 }
7606 return false;
7607 }
7608 // Deadly Throw Interrupt
7609 case 32748:
7610 {
7611 // Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw
7612 if (this == victim)
7613 return false;
7614
7615 triggered_spell_id = 32747;
7616 break;
7617 }
7618 }
7619 // Master of subtlety
7620 if (dummySpell->SpellIconID == 2114)
7621 {
7622 triggered_spell_id = 31665;
7623 basepoints0 = triggerAmount;
7624 break;
7625 }
7626 // Cut to the Chase
7627 if (dummySpell->SpellIconID == 2909)
7628 {
7629 // "refresh your Slice and Dice duration to its 5 combo point maximum"
7630 // lookup Slice and Dice
7631 if (AuraEffect const* aur = GetAuraEffect(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_ROGUE, 0x40000, 0, 0))
7632 {
7633 aur->GetBase()->SetDuration(aur->GetSpellInfo()->GetMaxDuration(), true);
7634 return true;
7635 }
7636 return false;
7637 }
7638 // Deadly Brew
7639 else if (dummySpell->SpellIconID == 2963)
7640 {
7641 triggered_spell_id = 3409;
7642 break;
7643 }
7644 // Quick Recovery
7645 else if (dummySpell->SpellIconID == 2116)
7646 {
7647 if (!procSpell)
7648 return false;
7649
7650 // energy cost save
7651 basepoints0 = CalculatePct(int32(procSpell->ManaCost), triggerAmount);
7652 if (basepoints0 <= 0)
7653 return false;
7654
7655 target = this;
7656 triggered_spell_id = 31663;
7657 break;
7658 }
7659 break;
7660 }
7661 case SPELLFAMILY_HUNTER:
7662 {
7663 switch (dummySpell->SpellIconID)
7664 {
7665 case 2236: // Thrill of the Hunt
7666 {
7667 if (!procSpell)
7668 return false;
7669
7671
7672 // Disable charge drop because of Lock and Load
7673 if (spell)
7674 ToPlayer()->SetSpellModTakingSpell(spell, false);
7675
7676 // Explosive Shot
7677 if (procSpell->SpellFamilyFlags[2] & 0x200)
7678 {
7679 if (!victim)
7680 return false;
7681 if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
7682 basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4 / 10 / 3;
7683 }
7684 else
7685 basepoints0 = procSpell->CalcPowerCost(this, SpellSchoolMask(procSpell->SchoolMask)) * 4 / 10;
7686
7687 if (spell)
7688 ToPlayer()->SetSpellModTakingSpell(spell, true);
7689
7690 if (basepoints0 <= 0)
7691 return false;
7692
7693 target = this;
7694 triggered_spell_id = 34720;
7695 break;
7696 }
7697 case 3406: // Hunting Party
7698 {
7699 triggered_spell_id = 57669;
7700 target = this;
7701 break;
7702 }
7703 case 3560: // Rapid Recuperation
7704 {
7705 // This effect only from Rapid Killing (mana regen)
7706 if (!(procSpell->SpellFamilyFlags[1] & 0x01000000))
7707 return false;
7708
7709 target = this;
7710
7711 switch (dummySpell->Id)
7712 {
7713 case 53228: // Rank 1
7714 triggered_spell_id = 56654;
7715 break;
7716 case 53232: // Rank 2
7717 triggered_spell_id = 58882;
7718 break;
7719 }
7720 break;
7721 }
7722 }
7723
7724 switch (dummySpell->Id)
7725 {
7726 case 57870: // Glyph of Mend Pet
7727 {
7728 if (!victim)
7729 return false;
7730
7731 victim->CastSpell(victim, 57894, true, nullptr, nullptr, GetGUID());
7732 return true;
7733 }
7734 }
7735 break;
7736 }
7738 {
7739 // Light's Beacon - Beacon of Light
7740 if (dummySpell->Id == 53651)
7741 {
7742 if (!victim)
7743 return false;
7744
7745 // Do not proc from Glyph of Holy Light and Judgement of Light
7746 if (procSpell->Id == 20267 || procSpell->Id == 54968)
7747 {
7748 return false;
7749 }
7750
7751 Unit* beaconTarget = triggeredByAura->GetBase()->GetCaster();
7752 if (!beaconTarget || beaconTarget == this || !beaconTarget->GetAura(53563, victim->GetGUID()))
7753 return false;
7754
7755 basepoints0 = int32(damage);
7756 triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654;
7757
7758 victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura, victim->GetGUID());
7759 return true;
7760 }
7761 // Judgements of the Wise
7762 if (dummySpell->SpellIconID == 3017)
7763 {
7764 target = this;
7765 triggered_spell_id = 31930;
7766 // replenishment
7767 CastSpell(this, 57669, true, castItem, triggeredByAura);
7768 break;
7769 }
7770 // Righteous Vengeance
7771 if (dummySpell->SpellIconID == 3025)
7772 {
7773 if (!victim)
7774 return false;
7775
7776 // 4 damage tick
7777 basepoints0 = triggerAmount * damage / 400;
7778 triggered_spell_id = 61840;
7779 // Add remaining ticks to damage done
7780 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
7781 return true;
7782 }
7783 // Sheath of Light
7784 if (dummySpell->SpellIconID == 3030)
7785 {
7786 // 4 healing tick
7787 basepoints0 = triggerAmount * damage / 400;
7788 triggered_spell_id = 54203;
7789 break;
7790 }
7791 switch (dummySpell->Id)
7792 {
7793 // Judgement of Light
7794 case 20185:
7795 {
7796 if (!victim || !victim->IsAlive() || victim->HasSpellCooldown(20267))
7797 return false;
7798
7799 auto* caster = triggeredByAura->GetBase()->GetCaster();
7800 if (!caster || !victim->IsFriendlyTo(caster))
7801 return false;
7802
7803 // 2% of base health
7804 basepoints0 = int32(victim->CountPctFromMaxHealth(2));
7805 victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
7806 victim->AddSpellCooldown(20267, 0, 4 * IN_MILLISECONDS);
7807 return true;
7808 }
7809 // Judgement of Wisdom
7810 case 20186:
7811 {
7812 if (!victim || !victim->IsAlive() || !victim->HasActivePowerType(POWER_MANA) || victim->HasSpellCooldown(20268))
7813 return false;
7814
7815 auto* caster = triggeredByAura->GetBase()->GetCaster();
7816 if (!caster || !victim->IsFriendlyTo(caster))
7817 return false;
7818
7819 // 2% of base mana
7820 basepoints0 = int32(CalculatePct(victim->GetCreateMana(), 2));
7821 victim->CastCustomSpell(victim, 20268, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura);
7822 victim->AddSpellCooldown(20268, 0, 4 * IN_MILLISECONDS);
7823 return true;
7824 }
7825 // Holy Power (Redemption Armor set)
7826 case 28789:
7827 {
7828 if (!victim)
7829 return false;
7830
7831 // Set class defined buff
7832 switch (victim->getClass())
7833 {
7834 case CLASS_PALADIN:
7835 case CLASS_PRIEST:
7836 case CLASS_SHAMAN:
7837 case CLASS_DRUID:
7838 triggered_spell_id = 28795; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
7839 break;
7840 case CLASS_MAGE:
7841 case CLASS_WARLOCK:
7842 triggered_spell_id = 28793; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
7843 break;
7844 case CLASS_HUNTER:
7845 case CLASS_ROGUE:
7846 triggered_spell_id = 28791; // Increases the friendly target's attack power by $s1 for $d.
7847 break;
7848 case CLASS_WARRIOR:
7849 triggered_spell_id = 28790; // Increases the friendly target's armor
7850 break;
7851 default:
7852 return false;
7853 }
7854 break;
7855 }
7856 // Seal of Vengeance (damage calc on apply aura)
7857 case 31801:
7858 {
7859 if (effIndex != 0 || !victim) // effect 1, 2 used by seal unleashing code
7860 return false;
7861
7862 // At melee attack or Hammer of the Righteous spell damage considered as melee attack
7863 bool stacker = !procSpell || procSpell->Id == 53595;
7864 // spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
7865 bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
7866
7867 if (!stacker && !damager)
7868 return false;
7869
7870 triggered_spell_id = 31803;
7871
7872 if (Aura* aur = victim->GetAura(triggered_spell_id, GetGUID()))
7873 {
7874 if (aur->GetStackAmount() == 5)
7875 {
7876 if (stacker)
7877 aur->RefreshDuration();
7878 }
7879 }
7880
7881 CastSpell(victim, 42463, true, castItem, triggeredByAura); // Seal of Vengeance
7882
7883 if (!stacker)
7884 return false;
7885 break;
7886 }
7887 // Seal of Corruption
7888 case 53736:
7889 {
7890 if (effIndex != 0 || !victim) // effect 1, 2 used by seal unleashing code
7891 return false;
7892
7893 // At melee attack or Hammer of the Righteous spell damage considered as melee attack
7894 bool stacker = !procSpell || procSpell->Id == 53595;
7895 // spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
7896 bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
7897
7898 if (!stacker && !damager)
7899 return false;
7900
7901 triggered_spell_id = 53742;
7902
7903 if (Aura* aur = victim->GetAura(triggered_spell_id, GetGUID()))
7904 {
7905 if (aur->GetStackAmount() == 5)
7906 {
7907 if (stacker)
7908 aur->RefreshDuration();
7909 }
7910 }
7911
7912 CastSpell(victim, 53739, true, castItem, triggeredByAura); // Seal of Corruption
7913
7914 if (!stacker)
7915 return false;
7916 break;
7917 }
7918 // Spiritual Attunement
7919 case 31785:
7920 case 33776:
7921 {
7922 // if healed by another unit (victim)
7923 if (this == victim)
7924 return false;
7925
7926 // dont allow non-positive dots to proc
7927 if (!procSpell || !procSpell->IsPositive())
7928 return false;
7929
7930 HealInfo const* healInfo = eventInfo.GetHealInfo();
7931 if (!healInfo)
7932 {
7933 return false;
7934 }
7935
7936 uint32 effectiveHeal = healInfo->GetEffectiveHeal();
7937 if (effectiveHeal)
7938 {
7939 // heal amount
7940 basepoints0 = int32(CalculatePct(effectiveHeal, triggerAmount));
7941 target = this;
7942
7943 if (basepoints0)
7944 triggered_spell_id = 31786;
7945 }
7946 break;
7947 }
7948 // Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
7949 case 40470:
7950 {
7951 if (!procSpell)
7952 return false;
7953
7954 float chance = 0.0f;
7955
7956 // Flash of light/Holy light
7957 if (procSpell->SpellFamilyFlags[0] & 0xC0000000)
7958 {
7959 triggered_spell_id = 40471;
7960 chance = 15.0f;
7961 }
7962 // Judgement (any)
7963 else if (procSpell->SpellFamilyFlags[0] & 0x800000)
7964 {
7965 triggered_spell_id = 40472;
7966 chance = 50.0f;
7967 }
7968 else
7969 return false;
7970
7971 if (!roll_chance_f(chance))
7972 return false;
7973
7974 break;
7975 }
7976 // Glyph of Holy Light
7977 case 54937:
7978 {
7979 triggered_spell_id = 54968;
7980 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7981 break;
7982 }
7983 // Item - Paladin T8 Holy 2P Bonus
7984 case 64890:
7985 {
7986 triggered_spell_id = 64891;
7987 basepoints0 = triggerAmount * damage / 300;
7988 break;
7989 }
7990 case 71406: // Tiny Abomination in a Jar
7991 case 71545: // Tiny Abomination in a Jar (Heroic)
7992 {
7993 if (!victim || !victim->IsAlive())
7994 return false;
7995
7996 CastSpell(this, 71432, true, nullptr, triggeredByAura);
7997
7998 Aura const* dummy = GetAura(71432);
7999 if (!dummy || dummy->GetStackAmount() < (dummySpell->Id == 71406 ? 8 : 7))
8000 return false;
8001
8002 RemoveAurasDueToSpell(71432);
8003 triggered_spell_id = 71433; // default main hand attack
8004 // roll if offhand
8005 if (Player const* player = ToPlayer())
8006 if (player->GetWeaponForAttack(OFF_ATTACK, true) && urand(0, 1))
8007 triggered_spell_id = 71434;
8008 target = victim;
8009 break;
8010 }
8011 // Item - Icecrown 25 Normal Dagger Proc
8012 case 71880:
8013 {
8014 switch (getPowerType())
8015 {
8016 case POWER_MANA:
8017 triggered_spell_id = 71881;
8018 break;
8019 case POWER_RAGE:
8020 triggered_spell_id = 71883;
8021 break;
8022 case POWER_ENERGY:
8023 triggered_spell_id = 71882;
8024 break;
8025 case POWER_RUNIC_POWER:
8026 triggered_spell_id = 71884;
8027 break;
8028 default:
8029 return false;
8030 }
8031 break;
8032 }
8033 // Item - Icecrown 25 Heroic Dagger Proc
8034 case 71892:
8035 {
8036 switch (getPowerType())
8037 {
8038 case POWER_MANA:
8039 triggered_spell_id = 71888;
8040 break;
8041 case POWER_RAGE:
8042 triggered_spell_id = 71886;
8043 break;
8044 case POWER_ENERGY:
8045 triggered_spell_id = 71887;
8046 break;
8047 case POWER_RUNIC_POWER:
8048 triggered_spell_id = 71885;
8049 break;
8050 default:
8051 return false;
8052 }
8053 break;
8054 }
8055 }
8056 break;
8057 }
8058 case SPELLFAMILY_SHAMAN:
8059 {
8060 switch (dummySpell->Id)
8061 {
8062 // Tidal Force
8063 case 55198:
8064 {
8065 // Remove aura stack from caster
8066 RemoveAuraFromStack(55166);
8067 // drop charges
8068 return false;
8069 }
8070 // Totemic Power (The Earthshatterer set)
8071 case 28823:
8072 {
8073 if (!victim)
8074 return false;
8075
8076 // Set class defined buff
8077 switch (victim->getClass())
8078 {
8079 case CLASS_PALADIN:
8080 case CLASS_PRIEST:
8081 case CLASS_SHAMAN:
8082 case CLASS_DRUID:
8083 triggered_spell_id = 28824; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
8084 break;
8085 case CLASS_MAGE:
8086 case CLASS_WARLOCK:
8087 triggered_spell_id = 28825; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
8088 break;
8089 case CLASS_HUNTER:
8090 case CLASS_ROGUE:
8091 triggered_spell_id = 28826; // Increases the friendly target's attack power by $s1 for $d.
8092 break;
8093 case CLASS_WARRIOR:
8094 triggered_spell_id = 28827; // Increases the friendly target's armor
8095 break;
8096 default:
8097 return false;
8098 }
8099 break;
8100 }
8101 // Lesser Healing Wave (Totem of Flowing Water Relic)
8102 case 28849:
8103 {
8104 target = this;
8105 triggered_spell_id = 28850;
8106 break;
8107 }
8108 // Windfury Weapon (Passive) 1-8 Ranks
8109 case 33757:
8110 {
8111 Player* player = ToPlayer();
8112 if (!player || !castItem || !castItem->IsEquipped() || !victim || !victim->IsAlive())
8113 return false;
8114
8115 if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
8116 return false;
8117
8118 WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
8119 if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
8120 || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8121 || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
8122 return false;
8123
8124 // Now amount of extra power stored in 1 effect of Enchant spell
8125 // Get it by item enchant id
8126 uint32 spellId;
8128 {
8129 case 283:
8130 spellId = 8232;
8131 break; // 1 Rank
8132 case 284:
8133 spellId = 8235;
8134 break; // 2 Rank
8135 case 525:
8136 spellId = 10486;
8137 break; // 3 Rank
8138 case 1669:
8139 spellId = 16362;
8140 break; // 4 Rank
8141 case 2636:
8142 spellId = 25505;
8143 break; // 5 Rank
8144 case 3785:
8145 spellId = 58801;
8146 break; // 6 Rank
8147 case 3786:
8148 spellId = 58803;
8149 break; // 7 Rank
8150 case 3787:
8151 spellId = 58804;
8152 break; // 8 Rank
8153 default:
8154 {
8155 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) {} for spell id: {} (Windfury)",
8156 castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id);
8157 return false;
8158 }
8159 }
8160
8161 SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
8162 if (!windfurySpellInfo)
8163 {
8164 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non-existing spell id: {} (Windfury)", spellId);
8165 return false;
8166 }
8167
8168 int32 extra_attack_power = CalculateSpellDamage(victim, windfurySpellInfo, 1);
8169
8170 // Value gained from additional AP
8171 basepoints0 = int32(extra_attack_power / 14.0f * GetAttackTime(attType) / 1000);
8172
8173 if (procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
8174 triggered_spell_id = 25504;
8175
8176 if (procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8177 triggered_spell_id = 33750;
8178
8179 // custom cooldown processing case
8180 if (player->HasSpellCooldown(dummySpell->Id))
8181 return false;
8182
8183 // apply cooldown before cast to prevent processing itself
8184 player->AddSpellCooldown(dummySpell->Id, 0, 3 * IN_MILLISECONDS);
8185
8186 // Attack Twice
8187 for (uint32 i = 0; i < 2; ++i)
8188 CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
8189
8190 return true;
8191 }
8192 // Shaman Tier 6 Trinket
8193 case 40463:
8194 {
8195 if (!procSpell)
8196 return false;
8197
8198 float chance;
8199 if (procSpell->SpellFamilyFlags[0] & 0x1)
8200 {
8201 triggered_spell_id = 40465; // Lightning Bolt
8202 chance = 15.0f;
8203 }
8204 else if (procSpell->SpellFamilyFlags[0] & 0x80)
8205 {
8206 triggered_spell_id = 40465; // Lesser Healing Wave
8207 chance = 10.0f;
8208 }
8209 else if (procSpell->SpellFamilyFlags[1] & 0x00000010)
8210 {
8211 triggered_spell_id = 40466; // Stormstrike
8212 chance = 50.0f;
8213 }
8214 else
8215 return false;
8216
8217 if (!roll_chance_f(chance))
8218 return false;
8219
8220 target = this;
8221 break;
8222 }
8223 // Glyph of Healing Wave
8224 case 55440:
8225 {
8226 // Not proc from self heals
8227 if (this == victim)
8228 return false;
8229 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8230 target = this;
8231 triggered_spell_id = 55533;
8232 break;
8233 }
8234 // Spirit Hunt
8235 case 58877:
8236 {
8237 // Cast on owner
8238 target = GetOwner();
8239 if (!target)
8240 return false;
8241 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8242 triggered_spell_id = 58879;
8243 // Heal wolf
8244 CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8245 break;
8246 }
8247 // Shaman T9 Elemental 4P Bonus
8248 case 67228:
8249 {
8250 // Lava Burst
8251 if (procSpell->SpellFamilyFlags[1] & 0x1000)
8252 {
8253 triggered_spell_id = 71824;
8254 SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
8255 if (!triggeredSpell)
8256 return false;
8257 basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
8258 }
8259 break;
8260 }
8261 // Item - Shaman T10 Elemental 4P Bonus
8262 case 70817:
8263 {
8264 if (!target)
8265 return false;
8266 // try to find spell Flame Shock on the target
8267 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x0, 0x0, GetGUID()))
8268 {
8269 Aura* flameShock = aurEff->GetBase();
8270 int32 extraTime = 2 * aurEff->GetAmplitude();
8271 flameShock->SetMaxDuration(flameShock->GetMaxDuration() + extraTime);
8272 flameShock->SetDuration(flameShock->GetDuration() + extraTime);
8273
8274 return true;
8275 }
8276 // if not found Flame Shock
8277 return false;
8278 }
8279 break;
8280 }
8281 // Frozen Power
8282 if (dummySpell->SpellIconID == 3780)
8283 {
8284 if (!target)
8285 return false;
8286 if (GetDistance(target) < 15.0f)
8287 return false;
8288 float chance = (float)triggerAmount;
8289 if (!roll_chance_f(chance))
8290 return false;
8291
8292 triggered_spell_id = 63685;
8293 break;
8294 }
8295 // Ancestral Awakening
8296 if (dummySpell->SpellIconID == 3065)
8297 {
8298 triggered_spell_id = 52759;
8299 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8300 target = this;
8301 break;
8302 }
8303 // Flametongue Weapon (Passive)
8304 if (dummySpell->SpellFamilyFlags[0] & 0x200000)
8305 {
8306 if (!IsPlayer() || !victim || !victim->IsAlive() || !castItem || !castItem->IsEquipped())
8307 return false;
8308
8310 if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
8311 || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8312 || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
8313 return false;
8314
8315 float fire_onhit = float(CalculatePct(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
8316
8317 float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE)
8319
8320 // 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
8321 ApplyPct(add_spellpower, 3.84f);
8322
8323 // Enchant on Off-Hand and ready?
8324 if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8325 {
8326 float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK) / 1000.0f;
8327
8328 // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
8329 basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
8330 triggered_spell_id = 10444;
8331 }
8332
8333 // Enchant on Main-Hand and ready?
8334 else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
8335 {
8336 float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK) / 1000.0f;
8337
8338 // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
8339 basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
8340 triggered_spell_id = 10444;
8341 }
8342
8343 // If not ready, we should return, shouldn't we?!
8344 else
8345 return false;
8346
8347 CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
8348 return true;
8349 }
8350 // Improved Water Shield
8351 if (dummySpell->SpellIconID == 2287)
8352 {
8353 if (!procSpell)
8354 return false;
8355
8356 // Default chance for Healing Wave and Riptide
8357 float chance = (float)triggeredByAura->GetAmount();
8358
8359 if (procSpell->SpellFamilyFlags[0] & 0x80)
8360 // Lesser Healing Wave - 0.6 of default
8361 chance *= 0.6f;
8362 else if (procSpell->SpellFamilyFlags[0] & 0x100)
8363 // Chain heal - 0.3 of default
8364 chance *= 0.3f;
8365
8366 if (!roll_chance_f(chance))
8367 return false;
8368
8369 // Water Shield
8370 if (AuraEffect const* aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0, 0x00000020, 0))
8371 {
8372 uint32 spell = aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
8373 CastSpell(this, spell, true, castItem, triggeredByAura);
8374 return true;
8375 }
8376 return false;
8377 }
8378 // Lightning Overload
8379 if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
8380 {
8381 if (!procSpell || !IsPlayer() || !victim)
8382 return false;
8383
8384 if (procEx & PROC_EX_CRITICAL_HIT)
8385 damage /= 2;
8386
8387 // do not proc off from itself
8388 if (procSpell->Id == 45297 || procSpell->Id == 45284)
8389 {
8390 return false;
8391 }
8392
8393 do
8394 {
8395 uint32 spell = 0;
8396
8397 if (procSpell->SpellFamilyFlags[0] & 0x2)
8398 {
8399 // 1/3 of 33% if 11%
8400 if (!roll_chance_i(33))
8401 return false;
8402
8403 spell = 45297;
8404 }
8405 else
8406 spell = 45284;
8407
8408 // do not reduce damage-spells have correct basepoints
8409 damage /= 2;
8410 int32 dmg = damage;
8411
8412 // Cast
8413 CastCustomSpell(victim, spell, &dmg, 0, 0, true, castItem, triggeredByAura);
8414 } while (roll_chance_i(33));
8415 return true;
8416 }
8417 // Static Shock
8418 if (dummySpell->SpellIconID == 3059)
8419 {
8420 // Lightning Shield
8422 {
8423 uint32 spell = sSpellMgr->GetSpellWithRank(26364, aurEff->GetSpellInfo()->GetRank());
8424 CastSpell(target, spell, true, castItem, triggeredByAura);
8425 aurEff->GetBase()->DropCharge();
8426 return true;
8427 }
8428 return false;
8429 }
8430 break;
8431 }
8433 {
8434 // Improved Blood Presence
8435 if (dummySpell->SpellIconID == 2636)
8436 {
8437 if (!IsPlayer())
8438 return false;
8439 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8440 break;
8441 }
8442 // Butchery
8443 if (dummySpell->SpellIconID == 2664)
8444 {
8445 basepoints0 = triggerAmount;
8446 triggered_spell_id = 50163;
8447 target = this;
8448 break;
8449 }
8450 // Mark of Blood
8451 if (dummySpell->Id == 49005)
8452 {
8454 triggered_spell_id = 61607;
8455 break;
8456 }
8457 // Unholy Blight
8458 if (dummySpell->Id == 49194)
8459 {
8460 triggered_spell_id = 50536;
8461 SpellInfo const* unholyBlight = sSpellMgr->GetSpellInfo(triggered_spell_id);
8462 if (!unholyBlight || !victim)
8463 return false;
8464
8465 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8466
8467 //Glyph of Unholy Blight
8468 if (AuraEffect* glyph = GetAuraEffect(63332, 0))
8469 AddPct(basepoints0, glyph->GetAmount());
8470
8471 basepoints0 = basepoints0 / (unholyBlight->GetMaxDuration() / unholyBlight->Effects[0].Amplitude);
8472 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
8473 return true;
8474 }
8475 // Vendetta
8476 if (dummySpell->SpellFamilyFlags[0] & 0x10000)
8477 {
8478 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
8479 triggered_spell_id = 50181;
8480 target = this;
8481 break;
8482 }
8483 // Necrosis
8484 if (dummySpell->SpellIconID == 2709)
8485 {
8486 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8487 triggered_spell_id = 51460;
8488 break;
8489 }
8490 // Threat of Thassarian
8491 if (dummySpell->SpellIconID == 2023)
8492 {
8493 // Must Dual Wield
8494 if (!procSpell || !HasOffhandWeaponForAttack())
8495 return false;
8496 // Chance as basepoints for dummy aura
8497 if (!roll_chance_i(triggerAmount))
8498 return false;
8499
8500 switch (procSpell->Id)
8501 {
8502 // Obliterate
8503 case 49020:
8504 triggered_spell_id = 66198;
8505 break; // Rank 1
8506 case 51423:
8507 triggered_spell_id = 66972;
8508 break; // Rank 2
8509 case 51424:
8510 triggered_spell_id = 66973;
8511 break; // Rank 3
8512 case 51425:
8513 triggered_spell_id = 66974;
8514 break; // Rank 4
8515
8516 // Frost Strike
8517 case 49143:
8518 triggered_spell_id = 66196;
8519 break; // Rank 1
8520 case 51416:
8521 triggered_spell_id = 66958;
8522 break; // Rank 2
8523 case 51417:
8524 triggered_spell_id = 66959;
8525 break; // Rank 3
8526 case 51418:
8527 triggered_spell_id = 66960;
8528 break; // Rank 4
8529 case 51419:
8530 triggered_spell_id = 66961;
8531 break; // Rank 5
8532 case 55268:
8533 triggered_spell_id = 66962;
8534 break; // Rank 6
8535
8536 // Plague Strike
8537 case 45462:
8538 triggered_spell_id = 66216;
8539 break; // Rank 1
8540 case 49917:
8541 triggered_spell_id = 66988;
8542 break; // Rank 2
8543 case 49918:
8544 triggered_spell_id = 66989;
8545 break; // Rank 3
8546 case 49919:
8547 triggered_spell_id = 66990;
8548 break; // Rank 4
8549 case 49920:
8550 triggered_spell_id = 66991;
8551 break; // Rank 5
8552 case 49921:
8553 triggered_spell_id = 66992;
8554 break; // Rank 6
8555
8556 // Death Strike
8557 case 49998:
8558 triggered_spell_id = 66188;
8559 break; // Rank 1
8560 case 49999:
8561 triggered_spell_id = 66950;
8562 break; // Rank 2
8563 case 45463:
8564 triggered_spell_id = 66951;
8565 break; // Rank 3
8566 case 49923:
8567 triggered_spell_id = 66952;
8568 break; // Rank 4
8569 case 49924:
8570 triggered_spell_id = 66953;
8571 break; // Rank 5
8572
8573 // Rune Strike
8574 case 56815:
8575 triggered_spell_id = 66217;
8576 break; // Rank 1
8577
8578 // Blood Strike
8579 case 45902:
8580 triggered_spell_id = 66215;
8581 break; // Rank 1
8582 case 49926:
8583 triggered_spell_id = 66975;
8584 break; // Rank 2
8585 case 49927:
8586 triggered_spell_id = 66976;
8587 break; // Rank 3
8588 case 49928:
8589 triggered_spell_id = 66977;
8590 break; // Rank 4
8591 case 49929:
8592 triggered_spell_id = 66978;
8593 break; // Rank 5
8594 case 49930:
8595 triggered_spell_id = 66979;
8596 break; // Rank 6
8597 default:
8598 return false;
8599 }
8600
8601 // This should do, restore spell mod so next attack can also use this!
8602 // crit chance for first strike is already computed
8603 ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, nullptr); // Killing Machine
8604 ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, nullptr); // Deathchill
8605
8606 // Xinef: Somehow basepoints are divided by 2 which is later divided by 2 (offhand multiplier)
8607 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
8608 if (triggerEntry->SchoolMask & SPELL_SCHOOL_MASK_NORMAL)
8609 basepoints0 = triggerEntry->Effects[EFFECT_0].BasePoints * 2;
8610
8611 SetCantProc(true);
8612 if (basepoints0)
8613 CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8614 else
8615 CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
8616 SetCantProc(false);
8617 return true;
8618 }
8619 // Runic Power Back on Snare/Root
8620 if (dummySpell->Id == 61257)
8621 {
8622 // only for spells and hit/crit (trigger start always) and not start from self casted spells
8623 if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
8624 return false;
8625 // Need snare or root mechanic
8626 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_SNARE))))
8627 return false;
8628 triggered_spell_id = 61258;
8629 target = this;
8630 break;
8631 }
8632 // Sudden Doom
8633 if (dummySpell->SpellIconID == 1939 && IsPlayer())
8634 {
8635 SpellChainNode const* chain = nullptr;
8636 // get highest rank of the Death Coil spell
8637 PlayerSpellMap const& sp_list = ToPlayer()->GetSpellMap();
8638 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
8639 {
8640 // check if shown in spell book
8641 if (!itr->second->Active || !itr->second->IsInSpec(ToPlayer()->GetActiveSpec()) || itr->second->State == PLAYERSPELL_REMOVED)
8642 continue;
8643
8644 SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(itr->first);
8645 if (!spellProto)
8646 continue;
8647
8648 if (spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT
8649 && spellProto->SpellFamilyFlags[0] & 0x2000)
8650 {
8651 SpellChainNode const* newChain = sSpellMgr->GetSpellChainNode(itr->first);
8652
8653 // No chain entry or entry lower than found entry
8654 if (!chain || !newChain || (chain->rank < newChain->rank))
8655 {
8656 triggered_spell_id = itr->first;
8657 chain = newChain;
8658 }
8659 else
8660 continue;
8661 // Found spell is last in chain - do not need to look more
8662 // Optimisation for most common case
8663 if (chain && chain->last->Id == itr->first)
8664 break;
8665 }
8666 }
8667 }
8668 break;
8669 }
8670 case SPELLFAMILY_POTION:
8671 {
8672 // alchemist's stone
8673 if (dummySpell->Id == 17619)
8674 {
8675 if (procSpell->SpellFamilyName == SPELLFAMILY_POTION)
8676 {
8677 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
8678 {
8679 if (procSpell->Effects[i].Effect == SPELL_EFFECT_HEAL)
8680 {
8681 triggered_spell_id = 21399;
8682 }
8683 else if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
8684 {
8685 triggered_spell_id = 21400;
8686 }
8687 else
8688 continue;
8689
8690 basepoints0 = int32(CalculateSpellDamage(this, procSpell, i) * 0.4f);
8691 CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, nullptr, triggeredByAura);
8692 }
8693 return true;
8694 }
8695 }
8696 break;
8697 }
8698 case SPELLFAMILY_PET:
8699 {
8700 switch (dummySpell->SpellIconID)
8701 {
8702 // Guard Dog
8703 case 201:
8704 {
8705 if (!victim)
8706 return false;
8707
8708 triggered_spell_id = 54445;
8709 target = this;
8710 float addThreat = float(CalculatePct(procSpell->Effects[0].CalcValue(this), triggerAmount));
8711 victim->AddThreat(this, addThreat);
8712 break;
8713 }
8714 // Silverback
8715 case 1582:
8716 triggered_spell_id = dummySpell->Id == 62765 ? 62801 : 62800;
8717 target = this;
8718 break;
8719 }
8720 break;
8721 }
8722 default:
8723 break;
8724 }
8725
8726 // if not handled by custom case, get triggered spell from dummySpell proto
8727 if (!triggered_spell_id)
8728 triggered_spell_id = dummySpell->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
8729
8730 // processed charge only counting case
8731 if (!triggered_spell_id)
8732 return true;
8733
8734 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
8735 if (!triggerEntry)
8736 {
8737 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: Spell {} has non-existing triggered spell {}", dummySpell->Id, triggered_spell_id);
8738 return false;
8739 }
8740
8741 if (cooldown_spell_id == 0)
8742 cooldown_spell_id = triggered_spell_id;
8743
8744 if (cooldown)
8745 {
8746 if (HasSpellCooldown(cooldown_spell_id))
8747 return false;
8748
8749 AddSpellCooldown(cooldown_spell_id, 0, cooldown);
8750 }
8751
8752 if (basepoints0)
8753 CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8754 else
8755 CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
8756
8757 return true;
8758}
constexpr auto IN_MILLISECONDS
Definition Common.h:53
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition CreatureAIImpl.h:25
EnchantmentSlot
Definition Item.h:168
@ TEMP_ENCHANTMENT_SLOT
Definition Item.h:170
std::map< uint32, SpellCooldown > SpellCooldowns
Definition Player.h:208
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition Player.h:193
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:695
@ PLAYERSPELL_REMOVED
Definition Player.h:122
int32 irand(int32 min, int32 max)
Definition Random.cpp:37
@ SPELL_EFFECT_ENERGIZE
Definition SharedDefines.h:808
@ LANG_UNIVERSAL
Definition SharedDefines.h:735
@ CLASS_DRUID
Definition SharedDefines.h:151
@ CLASS_SHAMAN
Definition SharedDefines.h:147
@ CLASS_PRIEST
Definition SharedDefines.h:145
@ CLASS_WARLOCK
Definition SharedDefines.h:149
@ CLASS_MAGE
Definition SharedDefines.h:148
@ CLASS_PALADIN
Definition SharedDefines.h:142
@ CLASS_ROGUE
Definition SharedDefines.h:144
@ MECHANIC_STUN
Definition SharedDefines.h:1337
@ MECHANIC_ROOT
Definition SharedDefines.h:1332
@ MECHANIC_SNARE
Definition SharedDefines.h:1336
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3533
@ SPELLFAMILY_PALADIN
Definition SharedDefines.h:3538
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3537
@ SPELLFAMILY_POTION
Definition SharedDefines.h:3541
@ SPELLFAMILY_ROGUE
Definition SharedDefines.h:3536
@ SPELLFAMILY_DRUID
Definition SharedDefines.h:3535
@ SPELLFAMILY_PET
Definition SharedDefines.h:3545
@ REP_EXALTED
Definition SharedDefines.h:187
@ SPELL_SCHOOL_MASK_SHADOW
Definition SharedDefines.h:302
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:299
@ SPELL_SCHOOL_MASK_FROST
Definition SharedDefines.h:301
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ SPELL_AURA_HASTE_SPELLS
Definition SpellAuraDefines.h:279
@ SPELL_AURA_MOD_MELEE_HASTE
Definition SpellAuraDefines.h:201
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition SpellAuraDefines.h:96
@ SPELL_AURA_PERIODIC_DUMMY
Definition SpellAuraDefines.h:289
@ PROC_EX_INTERNAL_HOT
Definition SpellMgr.h:220
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition SpellMgr.h:128
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS
Definition SpellMgr.h:122
WeaponAttackType
Definition Unit.h:208
T ApplyPct(T &base, U pct)
Definition Util.h:73
void SetMaxDuration(int32 duration)
Definition SpellAuras.h:130
Definition Unit.h:373
uint32 GetEffectiveHeal() const
Definition Unit.h:413
uint8 GetSlot() const
Definition Item.h:281
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:304
bool IsEquipped() const
Definition Item.cpp:789
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition Player.cpp:10109
void RestoreSpellMods(Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
Definition Player.cpp:9967
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16364
PlayerSpellMap const & GetSpellMap() const
Definition Player.h:1776
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11120
SpellCooldowns GetSpellCooldowns() const
Definition Player.h:2171
static uint8 GetAttackBySlot(uint8 slot)
Definition PlayerStorage.cpp:542
ReputationRank GetReputationRank(uint32 faction_id) const
Definition Player.cpp:5893
Unit * GetSelectedUnit() const
Definition Player.cpp:11571
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3536
void Say(std::string_view text, Language language, WorldObject const *=nullptr) override
Handles said message in regular chat based on declared language and in config pre-defined Range.
Definition Player.cpp:9370
Item * GetItemByGuid(ObjectGuid guid) const
Definition PlayerStorage.cpp:407
Spell * m_spellModTakingSpell
Definition Player.h:2555
int32 GetMaxDuration() const
Definition SpellInfo.cpp:2345
uint32 ProcChance
Definition SpellInfo.h:356
SpellInfo const * GetSpellInfo() const
Definition Spell.h:579
int32 GetPowerCost() const
Definition Spell.h:580
uint32 GetCreatePowers(Powers power) const
Definition Unit.cpp:15683
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5581
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition Unit.cpp:5253
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition Unit.cpp:14874
void SetCantProc(bool apply)
Definition Unit.cpp:17309
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1043
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4909
int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT=false)
Definition Unit.cpp:11998
bool IsFriendlyTo(Unit const *unit) const
Definition Unit.cpp:10264
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:11960
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1048
void CastDelayedSpellWithPeriodicAmount(Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
Definition Unit.cpp:20329
Powers getPowerType() const
Definition Unit.h:1058
void RemoveMovementImpairingAuras(bool withRoot)
Definition Unit.cpp:5234
Definition SpellMgr.h:554
SpellInfo const * last
Definition SpellMgr.h:558
uint8 rank
Definition SpellMgr.h:559
SpellInfo const * first
Definition SpellMgr.h:557

References AddPct(), Player::AddSpellCooldown(), AddSpellCooldown(), AddThreat(), ApplyPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, SpellInfo::CalcPowerCost(), CalculatePct(), CalculateSpellDamage(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), CastSpell(), CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CountPctFromMaxHealth(), CURRENT_GENERIC_SPELL, EFFECT_0, EFFECT_1, SpellInfo::Effects, ObjectGuid::Empty, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, SpellInfo::EquippedItemClass, SpellChainNode::first, SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), Player::GetAttackBySlot(), GetAttackTime(), GetAura(), GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraEffect::GetCaster(), Aura::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetCharges(), getClass(), GetCreateMana(), GetCreatePowers(), WorldObject::GetDistance(), Aura::GetDuration(), Aura::GetEffect(), HealInfo::GetEffectiveHeal(), AuraEffect::GetEffIndex(), Item::GetEnchantmentId(), GameTime::GetGameTime(), Player::GetGroup(), GetGuardianPet(), Object::GetGUID(), Object::GetGUID(), ProcEventInfo::GetHealInfo(), Player::GetItemByGuid(), Aura::GetMaxDuration(), SpellInfo::GetMaxDuration(), GetMaxPower(), GetOwner(), Spell::GetPowerCost(), getPowerType(), ProcEventInfo::GetProcSpell(), Player::GetReputationRank(), SpellInfo::GetSchoolMask(), Player::GetSelectedUnit(), Item::GetSlot(), Player::GetSpellCooldowns(), AuraEffect::GetSpellInfo(), Player::GetSpellMap(), Aura::GetStackAmount(), GetVictim(), HasActivePowerType(), HasAura(), Position::HasInArc(), HasOffhandWeaponForAttack(), Player::HasSpellCooldown(), HasSpellCooldown(), HealthBelowPct(), SpellInfo::Id, IN_MILLISECONDS, irand(), IsAlive(), Object::IsCreature(), Item::IsEquipped(), IsFriendlyTo(), Object::IsPlayer(), SpellInfo::IsPositive(), SpellInfo::IsRankOf(), LANG_UNIVERSAL, SpellChainNode::last, LOG_ERROR, m_currentSpells, Player::m_spellModTakingSpell, SpellInfo::ManaCost, MAX_SPELL_EFFECTS, MECHANIC_ROOT, MECHANIC_SNARE, MECHANIC_STUN, OFF_ATTACK, PLAYERSPELL_REMOVED, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_HOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, SpellInfo::ProcChance, RAND(), SpellChainNode::rank, RemoveAura(), RemoveAuraFromStack(), RemoveAurasByType(), RemoveAurasDueToSpell(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), Player::RemoveSpellCooldown(), REP_EXALTED, Player::RestoreSpellMods(), roll_chance_f(), roll_chance_i(), Player::Say(), SpellInfo::SchoolMask, AuraEffect::SetAmount(), SetCantProc(), Aura::SetDuration(), Aura::SetMaxDuration(), Player::SetSpellModTakingSpell(), SPELL_AURA_DUMMY, SPELL_AURA_HASTE_SPELLS, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_EFFECT_ENERGIZE, SPELL_EFFECT_HEAL, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_FROST, SPELL_SCHOOL_MASK_NORMAL, SPELL_SCHOOL_MASK_SHADOW, SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PET, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SPELLVALUE_BASE_POINT0, SpellInfo::SpellVisual, sSpellMgr, TEMP_ENCHANTMENT_SLOT, Object::ToPlayer(), and urand().

Referenced by ProcDamageAndSpellFor().

◆ HandleEmoteCommand()

void Unit::HandleEmoteCommand ( uint32  emoteId)
2001{
2003 packet.EmoteID = emoteId;
2004 packet.Guid = GetGUID();
2005 SendMessageToSet(packet.Write(), true);
2006}
Definition ChatPackets.h:29
WorldPacket const * Write() override
Definition ChatPackets.cpp:20
uint32 EmoteID
Definition ChatPackets.h:35
ObjectGuid Guid
Definition ChatPackets.h:36

References WorldPackets::Chat::Emote::EmoteID, Object::GetGUID(), WorldPackets::Chat::Emote::Guid, WorldObject::SendMessageToSet(), and WorldPackets::Chat::Emote::Write().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), boss_viscidus::DamageTaken(), DealMeleeDamage(), boss_twinemperorsAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), StandUpEvent::Execute(), PartyTimeEmoteEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), WorldSession::HandleEmoteOpcode(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcYellCommand(), WorldSession::HandleTextEmoteOpcode(), npc_maiev_illidan::IsSummonedBy(), npc_akama_illidan::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_sentinel_leader::MovementInform(), npc_sentinel_infiltrator::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), boss_illidan_stormrage::MovementInform(), npc_akama_illidan::MovementInform(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::MovementInform(), boss_felmyst::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), spell_gen_spectator_cheer_trigger::PrepareSpellScript(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), PetAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_felmyst::ScheduleFlightSequence(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), CreatureTextMgr::SendEmote(), boss_grand_warlock_nethekurse::SetData(), npc_harrison_jones::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_felmyst::StartIntro(), boss_ahune::Submerge(), boss_nightbane::TriggerHealthTakeOff(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_shenthul::npc_shenthulAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_highlord_tirion_fordring_lh::npc_highlord_tirion_fordringAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_valiance_keep_cannoneer::npc_valiance_keep_cannoneerAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_dancing_flames::npc_dancing_flamesAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), npc_rocknot::npc_rocknotAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_general_andorov::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ HandleOverrideClassScriptAuraProc()

bool Unit::HandleOverrideClassScriptAuraProc ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  cooldown 
)
private
9885{
9886 int32 scriptId = triggeredByAura->GetMiscValue();
9887
9888 if (!victim || !victim->IsAlive())
9889 return false;
9890
9891 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer()
9892 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
9893
9894 uint32 triggered_spell_id = 0;
9895
9896 switch (scriptId)
9897 {
9898 case 836: // Improved Blizzard (Rank 1)
9899 {
9900 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9901 return false;
9902 triggered_spell_id = 12484;
9903 break;
9904 }
9905 case 988: // Improved Blizzard (Rank 2)
9906 {
9907 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9908 return false;
9909 triggered_spell_id = 12485;
9910 break;
9911 }
9912 case 989: // Improved Blizzard (Rank 3)
9913 {
9914 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9915 return false;
9916 triggered_spell_id = 12486;
9917 break;
9918 }
9919 case 4533: // Dreamwalker Raiment 2 pieces bonus
9920 {
9921 // Chance 50%
9922 if (!roll_chance_i(50))
9923 return false;
9924
9925 switch (victim->getPowerType())
9926 {
9927 case POWER_MANA:
9928 triggered_spell_id = 28722;
9929 break;
9930 case POWER_RAGE:
9931 triggered_spell_id = 28723;
9932 break;
9933 case POWER_ENERGY:
9934 triggered_spell_id = 28724;
9935 break;
9936 default:
9937 return false;
9938 }
9939 break;
9940 }
9941 case 4537: // Dreamwalker Raiment 6 pieces bonus
9942 triggered_spell_id = 28750; // Blessing of the Claw
9943 break;
9944 case 5497: // Improved Mana Gems
9945 triggered_spell_id = 37445; // Mana Surge
9946 break;
9947 case 7010: // Revitalize - can proc on full hp target
9948 case 7011:
9949 case 7012:
9950 {
9951 if (!roll_chance_i(triggeredByAura->GetAmount()))
9952 return false;
9953 switch (victim->getPowerType())
9954 {
9955 case POWER_MANA:
9956 triggered_spell_id = 48542;
9957 break;
9958 case POWER_RAGE:
9959 triggered_spell_id = 48541;
9960 break;
9961 case POWER_ENERGY:
9962 triggered_spell_id = 48540;
9963 break;
9964 case POWER_RUNIC_POWER:
9965 triggered_spell_id = 48543;
9966 break;
9967 default:
9968 break;
9969 }
9970 break;
9971 }
9972 default:
9973 break;
9974 }
9975
9976 // not processed
9977 if (!triggered_spell_id)
9978 return false;
9979
9980 // standard non-dummy case
9981 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
9982
9983 if (!triggerEntry)
9984 {
9985 LOG_ERROR("entities.unit", "Unit::HandleOverrideClassScriptAuraProc: Spell {} triggering for class script id {}", triggered_spell_id, scriptId);
9986 return false;
9987 }
9988
9989 if (cooldown)
9990 {
9991 if (HasSpellCooldown(triggered_spell_id))
9992 return false;
9993
9994 AddSpellCooldown(triggered_spell_id, 0, cooldown);
9995 }
9996
9997 CastSpell(victim, triggered_spell_id, true, castItem, triggeredByAura);
9998
9999 return true;
10000}

References AddSpellCooldown(), CastSpell(), AuraEffect::GetAmount(), AuraEffect::GetBase(), Aura::GetCastItemGUID(), Player::GetItemByGuid(), AuraEffect::GetMiscValue(), getPowerType(), HasSpellCooldown(), IsAlive(), Object::IsPlayer(), LOG_ERROR, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, roll_chance_i(), SpellInfo::SpellVisual, sSpellMgr, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleProcExtraAttackFor()

void Unit::HandleProcExtraAttackFor ( Unit victim,
uint32  count 
)
2757{
2758 while (count)
2759 {
2760 --count;
2761 AttackerStateUpdate(victim, BASE_ATTACK, true);
2762 }
2763}
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition Unit.cpp:2565

References AttackerStateUpdate(), and BASE_ATTACK.

Referenced by Update().

◆ HandleProcTriggerSpell()

bool Unit::HandleProcTriggerSpell ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
uint32  procPhase,
ProcEventInfo eventInfo 
)
private
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
8958{
8959 // Get triggered aura spell info
8960 SpellInfo const* auraSpellInfo = triggeredByAura->GetSpellInfo();
8961
8962 // Basepoints of trigger aura
8963 int32 triggerAmount = triggeredByAura->GetAmount();
8964
8965 // Set trigger spell id, target, custom basepoints
8966 uint32 trigger_spell_id = auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
8967
8968 Unit* target = nullptr;
8969 int32 basepoints0 = 0;
8970
8971 if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
8972 basepoints0 = triggerAmount;
8973
8974 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer()
8975 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
8976
8977 // Try handle unknown trigger spells
8978 //if (sSpellMgr->GetSpellInfo(trigger_spell_id) == nullptr)
8979 {
8980 switch (auraSpellInfo->SpellFamilyName)
8981 {
8983 switch (auraSpellInfo->Id)
8984 {
8985 case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
8986 // Pct value stored in dummy
8987 if (!victim)
8988 return false;
8989 basepoints0 = victim->GetCreateHealth() * auraSpellInfo->Effects[1].CalcValue() / 100;
8990 target = victim;
8991 break;
8992 case 57345: // Darkmoon Card: Greatness
8993 {
8994 float stat = 0.0f;
8995 // strength
8996 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); }
8997 // agility
8998 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); }
8999 // intellect
9000 if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);}
9001 // spirit
9002 if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
9003 break;
9004 }
9005 case 67702: // Death's Choice, Item - Coliseum 25 Normal Melee Trinket
9006 {
9007 if (!damage)
9008 return false;
9009 float stat = 0.0f;
9010 // strength
9011 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); }
9012 // agility
9013 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
9014 break;
9015 }
9016 case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
9017 {
9018 if (!damage)
9019 return false;
9020 float stat = 0.0f;
9021 // strength
9022 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); }
9023 // agility
9024 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
9025 break;
9026 }
9027 case 27522: // Mana Drain Trigger
9028 case 40336: // Mana Drain Trigger
9029 case 46939: // Black Bow of the Betrayer
9030 {
9031 // On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
9032 if (IsAlive())
9033 CastSpell(this, 29471, true, castItem, triggeredByAura);
9034 if (victim && victim->IsAlive())
9035 CastSpell(victim, 27526, true, castItem, triggeredByAura);
9036 return true;
9037 }
9038 // Forge of Souls, Devourer of Souls, Mirrored Soul
9039 case 69023:
9040 {
9041 int32 dmg = damage * 0.45f;
9042 if (dmg > 0)
9043 if (Aura* a = GetAura(69023))
9044 if (Unit* c = a->GetCaster())
9045 CastCustomSpell(c, 69034, &dmg, 0, 0, true);
9046 return true;
9047 }
9048 // Soul-Trader Beacon proc aura
9049 case 50051:
9050 {
9051 if (!victim)
9052 return false;
9053
9054 if (Creature* cr = GetCompanionPet())
9055 cr->CastSpell(victim, 50101, true);
9056
9057 return false;
9058 }
9059 }
9060 break;
9061 case SPELLFAMILY_MAGE:
9062 if (auraSpellInfo->SpellIconID == 2127) // Blazing Speed
9063 {
9064 switch (auraSpellInfo->Id)
9065 {
9066 case 31641: // Rank 1
9067 case 31642: // Rank 2
9068 trigger_spell_id = 31643;
9069 break;
9070 default:
9071 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} miss posibly Blazing Speed", auraSpellInfo->Id);
9072 return false;
9073 }
9074 }
9075 else if (auraSpellInfo->Id == 71761) // Deep Freeze Immunity State (only permanent)
9076 {
9077 Creature* creature = victim->ToCreature();
9078 if (!creature || !creature->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1)))
9079 return false;
9080 }
9081 break;
9083 {
9084 // Nether Protection
9085 if (auraSpellInfo->SpellIconID == 1985)
9086 {
9087 if (!procSpell)
9088 return false;
9089 switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
9090 {
9092 return false; // ignore
9093 case SPELL_SCHOOL_HOLY:
9094 trigger_spell_id = 54370;
9095 break;
9096 case SPELL_SCHOOL_FIRE:
9097 trigger_spell_id = 54371;
9098 break;
9100 trigger_spell_id = 54375;
9101 break;
9102 case SPELL_SCHOOL_FROST:
9103 trigger_spell_id = 54372;
9104 break;
9106 trigger_spell_id = 54374;
9107 break;
9109 trigger_spell_id = 54373;
9110 break;
9111 default:
9112 return false;
9113 }
9114 }
9115 break;
9116 }
9117 case SPELLFAMILY_PRIEST:
9118 {
9119 // Blessed Recovery
9120 if (auraSpellInfo->SpellIconID == 1875)
9121 {
9122 switch (auraSpellInfo->Id)
9123 {
9124 case 27811:
9125 trigger_spell_id = 27813;
9126 break;
9127 case 27815:
9128 trigger_spell_id = 27817;
9129 break;
9130 case 27816:
9131 trigger_spell_id = 27818;
9132 break;
9133 default:
9134 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} not handled in BR", auraSpellInfo->Id);
9135 return false;
9136 }
9137 basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3;
9138 target = this;
9139 // Add remaining ticks to healing done
9140 CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0);
9141 return true;
9142 }
9143 break;
9144 }
9145 case SPELLFAMILY_DRUID:
9146 {
9147 switch (auraSpellInfo->Id)
9148 {
9149 // Druid Forms Trinket
9150 case 37336:
9151 {
9152 switch (GetShapeshiftForm())
9153 {
9154 case FORM_NONE:
9155 trigger_spell_id = 37344;
9156 break;
9157 case FORM_CAT:
9158 trigger_spell_id = 37341;
9159 break;
9160 case FORM_BEAR:
9161 case FORM_DIREBEAR:
9162 trigger_spell_id = 37340;
9163 break;
9164 case FORM_TREE:
9165 trigger_spell_id = 37342;
9166 break;
9167 case FORM_MOONKIN:
9168 trigger_spell_id = 37343;
9169 break;
9170 default:
9171 return false;
9172 }
9173 break;
9174 }
9175 // Druid T9 Feral Relic (Lacerate, Swipe, Mangle, and Shred)
9176 case 67353:
9177 {
9178 switch (GetShapeshiftForm())
9179 {
9180 case FORM_CAT:
9181 trigger_spell_id = 67355;
9182 break;
9183 case FORM_BEAR:
9184 case FORM_DIREBEAR:
9185 trigger_spell_id = 67354;
9186 break;
9187 default:
9188 return false;
9189 }
9190 break;
9191 }
9192 default:
9193 break;
9194 }
9195 break;
9196 }
9197 case SPELLFAMILY_HUNTER:
9198 {
9199 if (auraSpellInfo->SpellIconID == 3247) // Piercing Shots
9200 {
9201 if (!victim)
9202 return false;
9203
9204 switch (auraSpellInfo->Id)
9205 {
9206 case 53234: // Rank 1
9207 case 53237: // Rank 2
9208 case 53238: // Rank 3
9209 trigger_spell_id = 63468;
9210 break;
9211 default:
9212 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} miss posibly Piercing Shots", auraSpellInfo->Id);
9213 return false;
9214 }
9215 SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id);
9216 if (!TriggerPS)
9217 return false;
9218
9219 basepoints0 = CalculatePct(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
9220 victim->CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
9221 return true;
9222 }
9223 // Item - Hunter T9 4P Bonus (Steady Shot)
9224 else if (auraSpellInfo->Id == 67151)
9225 {
9226 if (!IsPlayer() || !ToPlayer()->GetPet())
9227 return false;
9228
9229 target = ToPlayer()->GetPet();
9230 trigger_spell_id = 68130;
9231 break;
9232 }
9233 break;
9234 }
9236 {
9237 switch (auraSpellInfo->Id)
9238 {
9239 // Soul Preserver
9240 case 60510:
9241 {
9242 switch (getClass())
9243 {
9244 case CLASS_DRUID:
9245 trigger_spell_id = 60512;
9246 break;
9247 case CLASS_PALADIN:
9248 trigger_spell_id = 60513;
9249 break;
9250 case CLASS_PRIEST:
9251 trigger_spell_id = 60514;
9252 break;
9253 case CLASS_SHAMAN:
9254 trigger_spell_id = 60515;
9255 break;
9256 }
9257
9258 target = this;
9259 break;
9260 }
9261 case 37657: // Lightning Capacitor
9262 case 54841: // Thunder Capacitor
9263 case 67712: // Item - Coliseum 25 Normal Caster Trinket
9264 case 67758: // Item - Coliseum 25 Heroic Caster Trinket
9265 {
9266 if (!victim || !victim->IsAlive() || !IsPlayer())
9267 return false;
9268
9269 uint32 stack_spell_id = 0;
9270 switch (auraSpellInfo->Id)
9271 {
9272 case 37657:
9273 stack_spell_id = 37658;
9274 trigger_spell_id = 37661;
9275 break;
9276 case 54841:
9277 stack_spell_id = 54842;
9278 trigger_spell_id = 54843;
9279 break;
9280 case 67712:
9281 stack_spell_id = 67713;
9282 trigger_spell_id = 67714;
9283 break;
9284 case 67758:
9285 stack_spell_id = 67759;
9286 trigger_spell_id = 67760;
9287 break;
9288 }
9289
9290 if (cooldown && ToPlayer()->HasSpellCooldown(stack_spell_id))
9291 {
9292 return false;
9293 }
9294
9295 CastSpell(this, stack_spell_id, true, nullptr, triggeredByAura);
9296
9297 Aura* dummy = GetAura(stack_spell_id);
9298 if (!dummy || dummy->GetStackAmount() < triggerAmount)
9299 {
9300 return false;
9301 }
9302
9303 if (cooldown)
9304 {
9305 ToPlayer()->AddSpellCooldown(stack_spell_id, 0, cooldown);
9306 }
9307 RemoveAurasDueToSpell(stack_spell_id);
9308 CastSpell(victim, trigger_spell_id, true, nullptr, triggeredByAura);
9309 return true;
9310 }
9311 default:
9312 // Illumination
9313 if (auraSpellInfo->SpellIconID == 241)
9314 {
9315 if (!procSpell)
9316 return false;
9317 // procspell is triggered spell but we need mana cost of original casted spell
9318 uint32 originalSpellId = procSpell->Id;
9319 // Holy Shock heal
9320 if (procSpell->SpellFamilyFlags[1] & 0x00010000)
9321 {
9322 switch (procSpell->Id)
9323 {
9324 case 25914:
9325 originalSpellId = 20473;
9326 break;
9327 case 25913:
9328 originalSpellId = 20929;
9329 break;
9330 case 25903:
9331 originalSpellId = 20930;
9332 break;
9333 case 27175:
9334 originalSpellId = 27174;
9335 break;
9336 case 33074:
9337 originalSpellId = 33072;
9338 break;
9339 case 48820:
9340 originalSpellId = 48824;
9341 break;
9342 case 48821:
9343 originalSpellId = 48825;
9344 break;
9345 default:
9346 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} not handled in HShock", procSpell->Id);
9347 return false;
9348 }
9349 }
9350 SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId);
9351 if (!originalSpell)
9352 {
9353 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} unknown but selected as original in Illu", originalSpellId);
9354 return false;
9355 }
9356 // percent stored in effect 1 (class scripts) base points
9357 int32 cost = int32(originalSpell->ManaCost + CalculatePct(GetCreateMana(), originalSpell->ManaCostPercentage));
9358 basepoints0 = CalculatePct(cost, auraSpellInfo->Effects[1].CalcValue());
9359 trigger_spell_id = 20272;
9360 target = this;
9361 }
9362 break;
9363 }
9364 break;
9365 }
9366 case SPELLFAMILY_SHAMAN:
9367 {
9368 // Lightning Shield (overwrite non existing triggered spell call in spell.dbc
9369 if (auraSpellInfo->SpellFamilyFlags[0] & 0x400 && auraSpellInfo->HasAttribute(SPELL_ATTR1_NO_THREAT))
9370 {
9371 // Do not proc off from self-casted items
9372 if (Spell const* spell = eventInfo.GetProcSpell())
9373 {
9374 if (spell->m_castItemGUID && victim->GetGUID() == GetGUID())
9375 {
9376 return false;
9377 }
9378 }
9379
9380 trigger_spell_id = sSpellMgr->GetSpellWithRank(26364, auraSpellInfo->GetRank());
9381 }
9382 // Nature's Guardian
9383 else if (auraSpellInfo->SpellIconID == 2013)
9384 {
9385 // Check health condition - should drop to less 30% (damage deal after this!)
9386 if (!HealthBelowPctDamaged(30, damage))
9387 return false;
9388
9389 if (victim && victim->IsAlive())
9390 victim->GetThreatMgr().ModifyThreatByPercent(this, -10);
9391
9392 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
9393 trigger_spell_id = 31616;
9394 target = this;
9395 }
9396 break;
9397 }
9399 {
9400 // Acclimation
9401 if (auraSpellInfo->SpellIconID == 1930)
9402 {
9403 if (!procSpell)
9404 return false;
9405 switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
9406 {
9408 return false; // ignore
9409 case SPELL_SCHOOL_HOLY:
9410 trigger_spell_id = 50490;
9411 break;
9412 case SPELL_SCHOOL_FIRE:
9413 trigger_spell_id = 50362;
9414 break;
9416 trigger_spell_id = 50488;
9417 break;
9418 case SPELL_SCHOOL_FROST:
9419 trigger_spell_id = 50485;
9420 break;
9422 trigger_spell_id = 50489;
9423 break;
9425 trigger_spell_id = 50486;
9426 break;
9427 default:
9428 return false;
9429 }
9430 }
9431 // Blood Presence (Improved)
9432 else if (auraSpellInfo->Id == 63611)
9433 {
9434 if (!IsPlayer())
9435 return false;
9436
9437 trigger_spell_id = 50475;
9438 basepoints0 = CalculatePct(int32(damage), triggerAmount);
9439 }
9440 break;
9441 }
9442 }
9443 }
9444
9445 // All ok. Check current trigger spell
9446 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
9447 if (!triggerEntry)
9448 {
9449 // Don't cast unknown spell
9450 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} (effIndex: {}) has unknown TriggerSpell {}. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex(), trigger_spell_id);
9451 return false;
9452 }
9453
9454 // not allow proc extra attack spell at extra attack
9455 if (triggerEntry->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
9456 {
9457 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
9458
9459 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
9460 if (lastExtraAttackSpell == trigger_spell_id)
9461 {
9462 return false;
9463 }
9464
9465 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
9466 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
9467 if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH)
9468 {
9469 return false;
9470 }
9471 }
9472
9473 // Custom requirements (not listed in procEx) Warning! damage dealing after this
9474 // Custom triggered spells
9475 switch (auraSpellInfo->Id)
9476 {
9477 // Deep Wounds
9478 case 12834:
9479 case 12849:
9480 case 12867:
9481 {
9482 if (!IsPlayer())
9483 return false;
9484
9485 if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK)
9487 else
9489 break;
9490 }
9491 // Persistent Shield (Scarab Brooch trinket)
9492 // This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
9493 case 26467:
9494 {
9495 basepoints0 = int32(CalculatePct(damage, 15));
9496 target = victim;
9497 trigger_spell_id = 26470;
9498 break;
9499 }
9500 // Unyielding Knights (item exploit 29108\29109)
9501 case 38164:
9502 {
9503 if (!victim || victim->GetEntry() != 19457) // Proc only if your target is Grillok
9504 return false;
9505 break;
9506 }
9507 // Deflection
9508 case 52420:
9509 {
9510 if (!HealthBelowPct(35))
9511 return false;
9512 break;
9513 }
9514
9515 // Cheat Death
9516 case 28845:
9517 {
9518 // When your health drops below 20%
9519 if (HealthBelowPctDamaged(20, damage) || HealthBelowPct(20))
9520 return false;
9521 break;
9522 }
9523 // Deadly Swiftness (Rank 1)
9524 case 31255:
9525 {
9526 // whenever you deal damage to a target who is below 20% health.
9527 if (!victim || !victim->IsAlive() || victim->HealthAbovePct(20))
9528 return false;
9529
9530 target = this;
9531 trigger_spell_id = 22588;
9532 [[fallthrough]];
9533 }
9534 // Bonus Healing (Crystal Spire of Karabor mace)
9535 case 40971:
9536 {
9537 // If your target is below $s1% health
9538 if (!victim || !victim->IsAlive() || victim->HealthAbovePct(triggerAmount))
9539 return false;
9540 break;
9541 }
9542 // Rapid Recuperation
9543 case 53228:
9544 case 53232:
9545 {
9546 // This effect only from Rapid Fire (ability cast)
9547 if (!procSpell || !(procSpell->SpellFamilyFlags[0] & 0x20))
9548 return false;
9549 break;
9550 }
9551 // Decimation
9552 case 63156:
9553 case 63158:
9554 // Can proc only if target has hp below 35%
9555 if (!victim || !victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
9556 return false;
9557 break;
9558 // Ulduar, Hodir, Toasty Fire
9559 case 62821:
9560 if (!this->IsPlayer()) // spell has Attribute, but persistent area auras ignore it
9561 return false;
9562 break;
9563 case 15337: // Improved Spirit Tap (Rank 1)
9564 case 15338: // Improved Spirit Tap (Rank 2)
9565 {
9566 if (!procSpell)
9567 return false;
9568
9569 if (procSpell->SpellFamilyFlags[0] & 0x800000)
9570 if ((procSpell->Id != 58381) || !roll_chance_i(50))
9571 return false;
9572
9573 target = victim;
9574 break;
9575 }
9576 // Professor Putricide - Ooze Spell Tank Protection
9577 case 71770:
9578 if (victim)
9579 victim->CastSpell(victim, trigger_spell_id, true); // EffectImplicitTarget is self
9580 return true;
9581 case 45057: // Evasive Maneuvers (Commendation of Kael`thas trinket)
9582 case 71634: // Item - Icecrown 25 Normal Tank Trinket 1
9583 case 71640: // Item - Icecrown 25 Heroic Tank Trinket 1
9584 case 75475: // Item - Chamber of Aspects 25 Normal Tank Trinket
9585 case 75481: // Item - Chamber of Aspects 25 Heroic Tank Trinket
9586 {
9587 // Procs only if damage takes health below $s1%
9588 if (!HealthBelowPctDamaged(triggerAmount, damage))
9589 return false;
9590 break;
9591 }
9592 default:
9593 break;
9594 }
9595
9596 if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
9597 {
9598 // Xinef: keep this order, Aura 70656 has SpellIconID 85!
9599 // Item - Death Knight T10 Melee 4P Bonus
9600 if (auraSpellInfo->Id == 70656)
9601 {
9603 return false;
9604
9605 for (uint8 i = 0; i < MAX_RUNES; ++i)
9606 if (ToPlayer()->GetRuneCooldown(i) == 0)
9607 return false;
9608 }
9609 // Blade Barrier
9610 else if (auraSpellInfo->SpellIconID == 85)
9611 {
9612 Player* plr = ToPlayer();
9613 if (!plr || !plr->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY) || !procSpell)
9614 return false;
9615
9617 return false;
9618 }
9619 // Rime
9620 else if (auraSpellInfo->SpellIconID == 56)
9621 {
9622 if (!IsPlayer())
9623 return false;
9624
9625 // Howling Blast
9627 }
9628 }
9629
9630 // Custom basepoints/target for exist spell
9631 // dummy basepoints or other customs
9632 switch (trigger_spell_id)
9633 {
9634 // Auras which should proc on area aura source (caster in this case):
9635 // Turn the Tables
9636 case 52914:
9637 case 52915:
9638 case 52910:
9639 // Honor Among Thieves
9640 case 51699:
9641 {
9642 target = triggeredByAura->GetBase()->GetCaster();
9643 if (!target)
9644 return false;
9645
9646 if (Player* pTarget = target->ToPlayer())
9647 {
9648 if (cooldown)
9649 {
9650 if (pTarget->HasSpellCooldown(trigger_spell_id))
9651 return false;
9652 pTarget->AddSpellCooldown(trigger_spell_id, 0, cooldown);
9653 }
9654
9655 Unit* cptarget = nullptr;
9656 if (trigger_spell_id == 51699)
9657 {
9658 cptarget = pTarget->GetComboTarget();
9659 if (!cptarget)
9660 {
9661 cptarget = pTarget->GetSelectedUnit();
9662 }
9663 }
9664 else
9665 cptarget = target;
9666
9667 if (cptarget)
9668 {
9669 target->CastSpell(cptarget, trigger_spell_id, true);
9670 return true;
9671 }
9672 }
9673 return false;
9674 }
9675 // Cast positive spell on enemy target
9676 case 7099: // Curse of Mending
9677 case 39703: // Curse of Mending
9678 case 20233: // Improved Lay on Hands (cast on target)
9679 {
9680 target = victim;
9681 break;
9682 }
9683 // Ruby Drake, Evasive Aura
9684 case 50241:
9685 {
9686 if (GetAura(50240))
9687 return false;
9688
9689 break;
9690 }
9691 // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset)
9692 case 15250: // Rogue Setup
9693 {
9694 // applied only for main target
9695 if (!victim || (IsPlayer() && victim != ToPlayer()->GetSelectedUnit()))
9696 return false;
9697 break; // continue normal case
9698 }
9699 // Finish movies that add combo
9700 case 14189: // Seal Fate (Netherblade set)
9701 case 14157: // Ruthlessness
9702 {
9703 victim = nullptr;
9704 // Need add combopoint AFTER finish movie (or they dropped in finish phase)
9705 break;
9706 }
9707 // Item - Druid T10 Balance 2P Bonus
9708 case 16870:
9709 {
9710 if (HasAura(70718))
9711 CastSpell(this, 70721, true);
9712 RemoveAurasDueToSpell(trigger_spell_id);
9713 break;
9714 }
9715 // Shamanistic Rage triggered spell
9716 case 30824:
9717 {
9718 basepoints0 = int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
9719 break;
9720 }
9721 // Enlightenment (trigger only from mana cost spells)
9722 case 35095:
9723 {
9724 if (!procSpell || procSpell->PowerType != POWER_MANA || (procSpell->ManaCost == 0 && procSpell->ManaCostPercentage == 0 && procSpell->ManaCostPerlevel == 0))
9725 return false;
9726 break;
9727 }
9728 case 46916: // Slam! (Bloodsurge proc)
9729 case 52437: // Sudden Death
9730 {
9731 // Item - Warrior T10 Melee 4P Bonus
9732 if (AuraEffect const* aurEff = GetAuraEffect(70847, 0))
9733 {
9734 if (!roll_chance_i(aurEff->GetAmount()))
9735 {
9736 // Xinef: dont allow normal proc to override set one
9737 if (GetAura((trigger_spell_id == 46916) ? 71072 : 71069))
9738 return false;
9739 // Xinef: just to be sure
9740 RemoveAurasDueToSpell(70849);
9741 break;
9742 }
9743
9744 // Xinef: fully remove all auras and reapply once more
9745 RemoveAurasDueToSpell(70849);
9746 RemoveAurasDueToSpell(71072);
9747 RemoveAurasDueToSpell(71069);
9748
9749 CastSpell(this, 70849, true, castItem, triggeredByAura); // Extra Charge!
9750 if (trigger_spell_id == 46916)
9751 CastSpell(this, 71072, true, castItem, triggeredByAura); // Slam GCD Reduced
9752 else
9753 CastSpell(this, 71069, true, castItem, triggeredByAura); // Execute GCD Reduced
9754 }
9755 break;
9756 }
9757 // Sword and Board
9758 case 50227:
9759 {
9760 // Remove cooldown on Shield Slam
9761 if (IsPlayer())
9763 break;
9764 }
9765 // Maelstrom Weapon
9766 case 53817:
9767 {
9768 // have rank dependent proc chance, ignore too often cases
9769 // PPM = 2.5 * (rank of talent),
9770 uint32 rank = auraSpellInfo->GetRank();
9771 // 5 rank -> 100% 4 rank -> 80% and etc from full rate
9772 if (!roll_chance_i(20 * rank))
9773 return false;
9774
9775 // Item - Shaman T10 Enhancement 4P Bonus
9776 if (AuraEffect const* aurEff = GetAuraEffect(70832, 0))
9777 if (Aura const* maelstrom = GetAura(53817))
9778 // xinef: we have 4 charges and all proc conditions are met - aura reaches 5 charges
9779 if ((maelstrom->GetStackAmount() == 4) && roll_chance_i(aurEff->GetAmount()))
9780 CastSpell(this, 70831, true, castItem, triggeredByAura);
9781
9782 break;
9783 }
9784 // Astral Shift
9785 case 52179:
9786 {
9787 if (!procSpell || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
9788 return false;
9789
9790 // Need stun, fear or silence mechanic
9791 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_SILENCE) | (1 << MECHANIC_STUN) | (1 << MECHANIC_FEAR))))
9792 return false;
9793 break;
9794 }
9795 // Glyph of Death's Embrace
9796 case 58679:
9797 {
9798 // Proc only from healing part of Death Coil. Check is essential as all Death Coil spells have 0x2000 mask in SpellFamilyFlags
9799 if (!procSpell || !(procSpell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && procSpell->SpellFamilyFlags[0] == 0x80002000))
9800 return false;
9801 break;
9802 }
9803 // Glyph of Death Grip
9804 case 58628:
9805 {
9806 // remove cooldown of Death Grip
9807 if (IsPlayer())
9808 ToPlayer()->RemoveSpellCooldown(49576, true);
9809 return true;
9810 }
9811 // Savage Defense
9812 case 62606:
9813 {
9814 basepoints0 = CalculatePct(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
9815 break;
9816 }
9817 // Body and Soul
9818 case 64128:
9819 case 65081:
9820 {
9821 // Proc only from PW:S cast
9822 if (!procSpell || !(procSpell->SpellFamilyFlags[0] & 0x00000001))
9823 return false;
9824 break;
9825 }
9826 // Culling the Herd
9827 case 70893:
9828 {
9829 if (!procSpell)
9830 {
9831 return false;
9832 }
9833 // check if we're doing a critical hit
9834 if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT))
9835 return false;
9836 // check if we're procced by Claw, Bite or Smack (need to use the spell icon ID to detect it)
9837 if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473))
9838 return false;
9839 break;
9840 }
9841 // Fingers of Frost, synchronise with Frostbite
9842 case 44544:
9843 {
9844 if (procPhase == PROC_SPELL_PHASE_HIT)
9845 {
9846 // Find Frostbite
9848 {
9849 if (!victim)
9850 return false;
9851
9852 uint8 fofRank = sSpellMgr->GetSpellRank(triggeredByAura->GetId());
9853 uint8 fbRank = sSpellMgr->GetSpellRank(aurEff->GetId());
9854 uint8 chance = uint8(std::ceil(fofRank * fbRank * 16.6f));
9855
9856 if (roll_chance_i(chance))
9857 CastSpell(victim, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true);
9858 }
9859 }
9860 break;
9861 }
9862 }
9863
9864 // try detect target manually if not set
9865 if (!target)
9866 target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim;
9867
9868 if (cooldown)
9869 {
9870 if (HasSpellCooldown(triggerEntry->Id))
9871 return false;
9872
9873 AddSpellCooldown(triggerEntry->Id, 0, cooldown);
9874 }
9875
9876 if (basepoints0)
9877 CastCustomSpell(target, triggerEntry->Id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
9878 else
9879 CastSpell(target, triggerEntry->Id, true, castItem, triggeredByAura);
9880
9881 return true;
9882}
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
Definition SharedDefines.h:797
@ SPELL_ATTR1_NO_THREAT
Definition SharedDefines.h:429
@ MECHANIC_FEAR
Definition SharedDefines.h:1330
@ MECHANIC_SILENCE
Definition SharedDefines.h:1334
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition SharedDefines.h:1305
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition SpellAuraDefines.h:294
@ SPELL_AURA_ADD_TARGET_TRIGGER
Definition SpellAuraDefines.h:172
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:244
@ FORM_MOONKIN
Definition UnitDefines.h:98
@ FORM_NONE
Definition UnitDefines.h:69
@ FORM_TREE
Definition UnitDefines.h:71
@ SPELL_HACK_AND_SLASH
Definition Unit.h:292
@ SPELL_SWORD_SPECIALIZATION
Definition Unit.h:291
bool HasMechanicTemplateImmunity(uint32 mask) const
Definition Creature.cpp:2214
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const
Definition Player.cpp:13515
void RemoveCategoryCooldown(uint32 cat)
Definition Player.cpp:3544
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition Player.cpp:1284
Spell const * GetProcSpell() const
Definition Unit.h:448
Unit * GetActor()
Definition Unit.h:439
uint8 GetRank() const
Definition SpellInfo.cpp:2494
uint32 ManaCostPercentage
Definition SpellInfo.h:367
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:876
uint32 ManaCost
Definition SpellInfo.h:363
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition ThreatMgr.cpp:508
bool HealthAbovePct(int32 pct) const
Definition Unit.h:1045
Creature * GetCompanionPet() const
Definition Unit.cpp:10689
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:15451
uint32 GetLastExtraAttackSpell() const
Definition Unit.h:960
uint32 GetCreateHealth() const
Definition Unit.h:1039
Unit * GetComboTarget() const
Definition Unit.h:966
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:1044

References Player::AddSpellCooldown(), AddSpellCooldown(), AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, CalculatePct(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_PALADIN, CLASS_PRIEST, CLASS_SHAMAN, CountPctFromMaxHealth(), EFFECT_0, SpellInfo::Effects, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_MOONKIN, FORM_NONE, FORM_TREE, ProcEventInfo::GetActor(), SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), GetAura(), GetAuraEffect(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), Aura::GetCaster(), Aura::GetCastItemGUID(), getClass(), GetComboTarget(), GetCompanionPet(), GetCreateHealth(), GetCreateMana(), AuraEffect::GetEffIndex(), Object::GetEntry(), GetFirstSchoolInMask(), Object::GetFloatValue(), Object::GetGUID(), Object::GetGUID(), AuraEffect::GetId(), Player::GetItemByGuid(), GetLastExtraAttackSpell(), SpellInfo::GetMaxDuration(), Player::GetPet(), ProcEventInfo::GetProcSpell(), SpellInfo::GetRank(), SpellInfo::GetSchoolMask(), GetShapeshiftForm(), AuraEffect::GetSpellInfo(), Aura::GetStackAmount(), GetStat(), GetThreatMgr(), GetTotalAttackPowerValue(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), SpellInfo::HasEffect(), Creature::HasMechanicTemplateImmunity(), HasSpellCooldown(), HealthAbovePct(), HealthBelowPct(), HealthBelowPctDamaged(), SpellInfo::Id, IsAlive(), Player::IsBaseRuneSlotsOnCooldown(), Player::IsClass(), IsClass(), Object::IsPlayer(), SpellInfo::IsPositive(), LOG_ERROR, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, SpellInfo::ManaCostPerlevel, MAX_RUNES, MECHANIC_FEAR, MECHANIC_SILENCE, MECHANIC_STUN, ThreatMgr::ModifyThreatByPercent(), POWER_MANA, SpellInfo::PowerType, PROC_EX_CRITICAL_HIT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, PROC_SPELL_PHASE_HIT, RemoveAurasDueToSpell(), Player::RemoveCategoryCooldown(), Player::RemoveSpellCooldown(), roll_chance_i(), RUNE_BLOOD, SPELL_ATTR1_NO_THREAT, SPELL_AURA_ADD_TARGET_TRIGGER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_EFFECT_ADD_EXTRA_ATTACKS, SPELL_HACK_AND_SLASH, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, SPELL_SWORD_SPECIALIZATION, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sSpellMgr, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STRENGTH, Object::ToCreature(), Object::ToPlayer(), UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MINDAMAGE, and UNIT_FIELD_MINOFFHANDDAMAGE.

Referenced by ProcDamageAndSpellFor().

◆ HandleSafeUnitPointersOnDelete()

void Unit::HandleSafeUnitPointersOnDelete ( Unit thisUnit)
static
4330{
4331 if (thisUnit->SafeUnitPointerSet.empty())
4332 return;
4333 for (std::set<SafeUnitPointer*>::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr)
4334 (*itr)->UnitDeleted();
4335
4336 thisUnit->SafeUnitPointerSet.clear();
4337}

References SafeUnitPointerSet.

Referenced by ~Unit().

◆ HandleSpellClick()

bool Unit::HandleSpellClick ( Unit clicker,
int8  seatId = -1 
)

First check simple relations from clicker to clickee

Check database conditions

19578{
19579 Creature* creature = ToCreature();
19580 if (creature && creature->IsAIEnabled)
19581 {
19582 if (!creature->AI()->BeforeSpellClick(clicker))
19583 {
19584 return false;
19585 }
19586 }
19587
19588 bool result = false;
19589 uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
19590 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
19591 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
19592 {
19594 if (!itr->second.IsFitToRequirements(clicker, this))
19595 continue;
19596
19598 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
19599 ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
19600 if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
19601 continue;
19602
19603 Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
19604 Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
19605 ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
19606
19607 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second.spellId);
19608
19609 // xinef: dont allow players to enter vehicles on arena
19610 if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->IsPlayer() && caster->FindMap() && caster->FindMap()->IsBattleArena())
19611 continue;
19612
19613 if (seatId > -1)
19614 {
19615 uint8 i = 0;
19616 bool valid = false;
19617 while (i < MAX_SPELL_EFFECTS)
19618 {
19619 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
19620 {
19621 valid = true;
19622 break;
19623 }
19624 ++i;
19625 }
19626
19627 if (!valid)
19628 {
19629 LOG_ERROR("sql.sql", "Spell {} specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
19630 continue;
19631 }
19632
19633 if (IsInMap(caster))
19634 caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0 + i), seatId + 1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
19635 else // This can happen during Player::_LoadAuras
19636 {
19638 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
19639 bp0[j] = spellInfo->Effects[j].BasePoints;
19640
19641 bp0[i] = seatId;
19642 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
19643 }
19644 }
19645 else
19646 {
19647 if (IsInMap(caster))
19648 caster->CastSpell(target, spellInfo, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
19649 else
19650 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
19651 }
19652
19653 result = true;
19654 }
19655
19656 if (creature && creature->IsAIEnabled)
19657 creature->AI()->OnSpellClick(clicker, result);
19658
19659 return result;
19660}
#define sConditionMgr
Definition ConditionMgr.h:290
std::list< Condition * > ConditionList
Definition ConditionMgr.h:237
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition ObjectMgr.h:408
@ NPC_CLICK_CAST_TARGET_CLICKER
Definition SharedDefines.h:691
@ NPC_CLICK_CAST_ORIG_CASTER_OWNER
Definition SharedDefines.h:692
@ NPC_CLICK_CAST_CASTER_CLICKER
Definition SharedDefines.h:690
SpellValueMod
Definition SpellDefines.h:112
virtual void OnSpellClick(Unit *, bool &)
Definition CreatureAI.h:203
virtual bool BeforeSpellClick(Unit *)
Definition CreatureAI.h:201
bool IsBattleArena() const
Definition Map.h:453
bool HasAura(AuraType aura) const
Definition SpellInfo.cpp:893
uint32 GetCreatureEntry() const
Definition Vehicle.h:39
Map * FindMap() const
Definition Object.h:537
Definition ConditionMgr.h:182

References Creature::AI(), CreatureAI::BeforeSpellClick(), CastCustomSpell(), CastSpell(), SpellInfo::Effects, WorldObject::FindMap(), Vehicle::GetCreatureEntry(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), GetVehicleKit(), SpellInfo::HasAura(), IsAIEnabled, Map::IsBattleArena(), WorldObject::IsInMap(), Object::IsPlayer(), LOG_ERROR, MAX_EFFECT_MASK, MAX_SPELL_EFFECTS, NPC_CLICK_CAST_CASTER_CLICKER, NPC_CLICK_CAST_ORIG_CASTER_OWNER, NPC_CLICK_CAST_TARGET_CLICKER, CreatureAI::OnSpellClick(), sConditionMgr, sObjectMgr, SPELL_AURA_CONTROL_VEHICLE, SPELLVALUE_BASE_POINT0, sSpellMgr, Object::ToCreature(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_NONE, and Aura::TryRefreshStackOrCreate().

Referenced by boss_xt002::boss_xt002AI::AttachHeart(), boss_kologarn::boss_kologarnAI::AttachLeftArm(), boss_kologarn::boss_kologarnAI::AttachRightArm(), WorldSession::HandleSpellClick(), Vehicle::InstallAccessory(), and npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI().

◆ HandleStatModifier()

bool Unit::HandleStatModifier ( UnitMods  unitMod,
UnitModifierType  modifierType,
float  amount,
bool  apply 
)
15227{
15228 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
15229 {
15230 LOG_ERROR("entities.unit", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
15231 return false;
15232 }
15233
15234 switch (modifierType)
15235 {
15236 case BASE_VALUE:
15237 case TOTAL_VALUE:
15238 m_auraModifiersGroup[unitMod][modifierType] += apply ? amount : -amount;
15239 break;
15240 case BASE_PCT:
15241 case TOTAL_PCT:
15242 ApplyPercentModFloatVar(m_auraModifiersGroup[unitMod][modifierType], amount, apply);
15243 break;
15244 default:
15245 break;
15246 }
15247
15248 if (!CanModifyStats())
15249 return false;
15250
15251 switch (unitMod)
15252 {
15259 break;
15260
15261 case UNIT_MOD_ARMOR:
15262 UpdateArmor();
15263 break;
15264 case UNIT_MOD_HEALTH:
15266 break;
15267
15268 case UNIT_MOD_MANA:
15269 case UNIT_MOD_RAGE:
15270 case UNIT_MOD_FOCUS:
15271 case UNIT_MOD_ENERGY:
15272 case UNIT_MOD_HAPPINESS:
15273 case UNIT_MOD_RUNE:
15276 break;
15277
15285 break;
15286
15289 break;
15292 break;
15293
15296 break;
15299 break;
15302 break;
15303
15304 default:
15305 break;
15306 }
15307
15308 return true;
15309}
@ UNIT_MOD_ARMOR
Definition Unit.h:156
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:163
@ UNIT_MOD_HEALTH
Definition Unit.h:148
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:167
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:165
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition Unit.h:164
SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:15368
Stats GetStatByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:15400
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
virtual void UpdateResistances(uint32 school)=0
Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const
Definition Unit.cpp:15429
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition StatSystem.cpp:60
virtual void UpdateArmor()=0
virtual void UpdateMaxPower(Powers power)=0
virtual bool UpdateStats(Stats stat)=0
bool CanModifyStats() const
Definition Unit.h:1024
virtual void UpdateMaxHealth()=0

References ApplyPercentModFloatVar(), BASE_ATTACK, BASE_PCT, BASE_VALUE, CanModifyStats(), GetPowerTypeByAuraGroup(), GetSpellSchoolByAuraGroup(), GetStatByAuraGroup(), LOG_ERROR, m_auraModifiersGroup, MODIFIER_TYPE_END, OFF_ATTACK, RANGED_ATTACK, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_END, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_RUNE, UNIT_MOD_RUNIC_POWER, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, UNIT_MOD_STAT_STRENGTH, UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDamagePhysical(), UpdateMaxHealth(), UpdateMaxPower(), UpdateResistances(), and UpdateStats().

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDependentAuraDamageMod(), boss_marli::_schedulePhaseSpider(), boss_marli::_schedulePhaseTroll(), Player::ApplyEnchantment(), AuraEffect::HandleAuraIncreaseBaseHealthPercent(), AuraEffect::HandleAuraModAttackPower(), AuraEffect::HandleAuraModAttackPowerPercent(), AuraEffect::HandleAuraModBaseResistancePCT(), AuraEffect::HandleAuraModIncreaseEnergy(), AuraEffect::HandleAuraModIncreaseEnergyPercent(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), AuraEffect::HandleAuraModRangedAttackPower(), AuraEffect::HandleAuraModRangedAttackPowerPercent(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), AuraEffect::HandleModBaseResistance(), AuraEffect::HandleModDamageDone(), AuraEffect::HandleModDamagePercentDone(), AuraEffect::HandleModOffhandDamagePercent(), AuraEffect::HandleModPercentStat(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), Guardian::InitStatsForLevel(), spell_astromancer_solarian_transform::OnApply(), spell_astromancer_solarian_transform::OnRemove(), boss_arlokk::boss_arlokkAI::Reset(), boss_marli::Reset(), and boss_arlokk::boss_arlokkAI::UpdateAI().

◆ HasActivePowerType()

◆ HasAllAuras()

template<typename... Auras>
bool Unit::HasAllAuras ( Auras...  spellIds) const
inline

Checks if the unit has ALL specified auras.

Template Parameters
AurasCan be any type convertible to uint32.
Parameters
spellIdsList of spell id's to check for on the unit.
Returns
Returns true if the unit has ALL of the specified auras. Otherwise false.
1415 {
1416 std::vector<uint32> spellList = { static_cast<uint32>(spellIds)... };
1417 return HasAuras(SearchMethod::MatchAll, spellList);
1418 }
bool HasAuras(SearchMethod sm, std::vector< uint32 > &spellIds) const
Check if unit has ANY or ALL specified auras.
Definition Unit.cpp:5698

References HasAuras(), and MatchAll.

Referenced by achievement_staying_buffed_all_winter_10::OnCheck(), achievement_staying_buffed_all_winter_25::OnCheck(), npc_aged_dying_ancient_kodo::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), and npc_nelson::npc_nelsonAI::SpellHit().

◆ HasAllowOnlyAbilityAura()

bool Unit::HasAllowOnlyAbilityAura ( ) const
inline
@ SPELL_AURA_ALLOW_ONLY_ABILITY
Definition SpellAuraDefines.h:326
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:5728

References HasAuraType(), and SPELL_AURA_ALLOW_ONLY_ABILITY.

Referenced by AuraEffect::HandleAuraAllowOnlyAbility().

◆ HasAnyAuras()

template<typename... Auras>
bool Unit::HasAnyAuras ( Auras...  spellIds) const
inline

◆ HasAOECharmAura()

bool Unit::HasAOECharmAura ( ) const
inline
@ SPELL_AURA_AOE_CHARM
Definition SpellAuraDefines.h:240

References HasAuraType(), and SPELL_AURA_AOE_CHARM.

◆ HasAttackerSpellCritChanceAura()

bool Unit::HasAttackerSpellCritChanceAura ( ) const
inline
@ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
Definition SpellAuraDefines.h:242

References HasAuraType(), and SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE.

Referenced by SpellTakenCritChance().

◆ HasAura()

bool Unit::HasAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5722{
5723 if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
5724 return true;
5725 return false;
5726}

References GetAuraApplication().

Referenced by boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), spell_warl_health_funnel::ApplyEffect(), boss_archavon::boss_archavonAI::AttackStart(), boss_emalon::boss_emalonAI::AttackStart(), boss_koralon::boss_koralonAI::AttackStart(), boss_toravon::boss_toravonAI::AttackStart(), boss_leotheras_the_blind::AttackStart(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), boss_hodir::boss_hodirAI::CanAIAttack(), boss_razorgore::boss_razorgoreAI::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_jindo::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_nethermancer_sepethrea::CanAIAttack(), boss_chromaggus::boss_chromaggusAI::CanAIAttack(), npc_parasitic_shadowfiend::CanAIAttack(), npc_wg_siege_machine::npc_wg_siege_machineAI::CanControlVehicle(), Player::CanJoinToBattleground(), Player::CanResummonPet(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CastItemCombatSpell(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), Spell::CheckItems(), spell_pal_hand_of_sacrifice::CheckTarget(), SpellInfo::CheckTarget(), spell_hun_lock_and_load::CheckTrapProc(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_thekal::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), boss_kalecgos::DoAction(), boss_illidan_stormrage::DoAction(), npc_midsummer_ribbon_pole_target::DoCleanupChecks(), Spell::DoCreateItem(), Spell::EffectDummy(), Spell::EffectHeal(), Spell::EffectInstaKill(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonPlayer(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), NPCStaveQuestAI::EvadeOnFeignDeath(), IceTombSummonEvent::Execute(), PartyTimeEmoteEvent::Execute(), spell_class_call_polymorph::FilterTargets(), spell_dru_wild_growth::FilterTargets(), spell_pri_circle_of_healing::FilterTargets(), lfg::LFGMgr::FinishDungeon(), GetDispellableAuraList(), Player::GetResurrectionSpellId(), go_wind_stone::go_wind_stoneAI::GossipHello(), go_soulwell::go_soulwellAI::GossipHello(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraMounted(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), spell_thaddius_pos_neg_charge::HandleDamage(), spell_capacitus_polarity_charge::HandleDamage(), spell_mage_summon_water_elemental::HandleDummy(), spell_rog_preparation::HandleDummy(), spell_warr_charge::HandleDummy(), HandleDummyAuraProc(), spell_q12851_going_bearback::HandleEffectApply(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), Player::HandleFall(), gm_commandscript::HandleGMVisibleCommand(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), BattlefieldWG::HandleKill(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleMessagechatOpcode(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_mark_of_frost_freeze::HandleOnHit(), OPvPCapturePointZM_GraveYard::HandleOpenGo(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_dk_blood_caked_blade::HandleProc(), HandleProcTriggerSpell(), spell_warr_vigilance::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_pal_lay_on_hands::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_q12611_deathbolt::HandleScriptEffect(), spell_dru_glyph_of_starfire::HandleScriptEffect(), misc_commandscript::HandleUnFreezeCommand(), HasAuras(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InformCloud(), boss_taldaram::InitializeAI(), Player::IsDeserter(), SpellArea::IsFitToRequirements(), npc_anzu_spirit::IsSummonedBy(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), lfg::LFGMgr::JoinLfg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), boss_sindragosa::boss_sindragosaAI::JustDied(), boss_hydross_the_unstable::JustDied(), boss_alar::JustDied(), boss_zuljin::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), boss_bjarngrim::boss_bjarngrimAI::JustEngagedWith(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::JustEngagedWith(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::JustEngagedWith(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), npc_hivezara_stinger::JustEngagedWith(), boss_vem::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_gurtogg_bloodboil::JustEngagedWith(), boss_hydross_the_unstable::JustEngagedWith(), npc_akama_illidan::JustReachedHome(), boss_hydross_the_unstable::JustReachedHome(), Kill(), boss_hydross_the_unstable::KilledUnit(), boss_hadronox::boss_hadronoxAI::KilledUnit(), Creature::LoadCreaturesAddon(), MeleeDamageBonusDone(), ModSpellCastTime(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_daranelle::npc_daranelleAI::MoveInLineOfSight(), boss_lady_vashj::MovementInform(), boss_kagani_nightstrike::MovementInform(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_innkeeper::OnGossipHello(), go_orb_of_domination::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::OnPlayerAreaUpdate(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::OnPlayerEnter(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerEnter(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), at_karazhan_atiesh_aran::OnTrigger(), at_hor_battered_hilt_start::OnTrigger(), at_hor_battered_hilt_throw::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), at_commander_dawnforge::OnTrigger(), MidsummerPlayerScript::OnUpdateZone(), Acore::FriendlyMissingBuffInRange::operator()(), NotInStomachSelector::operator()(), SindragosaIceTombCheck::operator()(), DefaultTargetSelector::operator()(), VampiricBiteTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), ShadowOfDeathSelector::operator()(), Acore::UnitAuraCheck::operator()(), SpectralBlastCheck::operator()(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Player::Regenerate(), Player::ReportedAfkBy(), npc_corrupted_totem::Reset(), boss_janalai::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_magus_telestra::Reset(), boss_illidan_stormrage::Reset(), boss_fathomlord_karathress::Reset(), npc_pet_pri_shadowfiend::Reset(), Player::RewardHonor(), RewardRage(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_jormungarAI::ScheduleEvents(), boss_supremus::SchedulePhase(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), boss_anomalus::SetData(), npc_thassarian2::npc_thassarian2AI::sGossipHello(), npc_chesspiece::sGossipHello(), npc_omen::npc_omenAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::SpellHit(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::SpellHit(), SpellPctDamageModsDone(), SpellTakenCritChance(), Player::StoreItem(), boss_moam::SummonedCreatureDies(), boss_apothecary_hummel::boss_apothecary_hummelAI::SummonedCreatureDies(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), npc_cyclone::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_moam::UpdateAI(), boss_ossirian::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), Player::UpdateAreaDependentAuras(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI(), boss_netherspite::UpdatePortals(), Player::UpdateZoneDependentAuras(), and Spell::WriteAmmoToPacket().

◆ HasAuraEffect()

bool Unit::HasAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  caster = ObjectGuid::Empty 
) const
5669{
5670 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5671 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5672 {
5673 if (itr->second->HasEffect(effIndex)
5674 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5675 {
5676 return true;
5677 }
5678 }
5679 return false;
5680}

References m_appliedAuras.

Referenced by Spell::CanAutoCast(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), spell_q12683_take_sputum_sample::HandleDummy(), AchievementCriteriaData::Meets(), and boss_headless_horseman::UpdateAI().

◆ HasAuras()

bool Unit::HasAuras ( SearchMethod  sm,
std::vector< uint32 > &  spellIds 
) const

Check if unit has ANY or ALL specified auras.

Parameters
smThe search method to use
spellIdsList of spell id's to check for on the unit.
Returns
Returns true if the search method condition is met. Otherwise false.
5699{
5700 if (sm == SearchMethod::MatchAll)
5701 {
5702 for (auto const& spellId : spellIds)
5703 if (!HasAura(spellId))
5704 return false;
5705 return true;
5706 }
5707 else if (sm == SearchMethod::MatchAny)
5708 {
5709 for (auto const& spellId : spellIds)
5710 if (HasAura(spellId))
5711 return true;
5712 return false;
5713 }
5714 else
5715 {
5716 LOG_ERROR("entities.unit", "Unit::HasAuras using non-supported SearchMethod {}", sm);
5717 return false;
5718 }
5719}

References HasAura(), LOG_ERROR, MatchAll, and MatchAny.

Referenced by HasAllAuras(), and HasAnyAuras().

◆ HasAuraState()

bool Unit::HasAuraState ( AuraStateType  flag,
SpellInfo const *  spellProto = nullptr,
Unit const *  Caster = nullptr 
) const
10571{
10572 if (Caster)
10573 {
10574 if (spellProto)
10575 {
10576 AuraEffectList const& stateAuras = Caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
10577 for (AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
10578 if ((*j)->IsAffectedOnSpell(spellProto))
10579 return true;
10580 }
10581 // Check per caster aura state
10582 // If aura with aurastate by caster not found return false
10583 if ((1 << (flag - 1)) & PER_CASTER_AURA_STATE_MASK)
10584 {
10585 AuraStateAurasMapBounds range = m_auraStateAuras.equal_range(flag);
10586 for (AuraStateAurasMap::const_iterator itr = range.first; itr != range.second; ++itr)
10587 if (itr->second->GetBase()->GetCasterGUID() == Caster->GetGUID())
10588 return true;
10589 return false;
10590 }
10591 }
10592
10593 return HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10594}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition SpellAuraDefines.h:325
std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
Definition Unit.h:650

References GetAuraEffectsByType(), Object::GetGUID(), Object::HasFlag(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, SPELL_AURA_ABILITY_IGNORE_AURASTATE, and UNIT_FIELD_AURASTATE.

Referenced by Player::_addSpell(), Pet::addSpell(), Spell::CheckCast(), spell_sha_earthliving_weapon::CheckProc(), SpellInfo::CheckTarget(), ClearAllReactives(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_sweeping_strikes::HandleProc(), HandleProcTriggerSpell(), isFrozen(), Player::LoadFromDB(), MeleeDamageBonusDone(), SpellPctDamageModsDone(), SpellTakenCritChance(), and UpdateReactives().

◆ HasAuraType()

bool Unit::HasAuraType ( AuraType  auraType) const
5729{
5730 return (!m_modAuras[auraType].empty());
5731}

References m_modAuras.

Referenced by Player::CanTameExoticPets(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraEmpathy(), AuraEffect::HandleAuraFeatherFall(), AuraEffect::HandleAuraHover(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModStalked(), AuraEffect::HandleAuraTrackStealthed(), AuraEffect::HandleAuraUntrackable(), AuraEffect::HandleAuraWaterWalk(), AuraEffect::HandleComprehendLanguage(), AuraEffect::HandleForceMoveForward(), HasAllowOnlyAbilityAura(), HasAOECharmAura(), HasAttackerSpellCritChanceAura(), HasAuraTypeWithFamilyFlags(), HasCloneCasterAura(), HasConfuseAura(), HasControlVehicleAura(), HasDecreaseSpeedAura(), HasDetectAmoreAura(), HasDetectSpellsAura(), HasFearAura(), HasFeatherFallAura(), HasFlyAura(), HasGhostAura(), HasHealthRegenInCombatAura(), HasHoverAura(), HasIgnoreHitDirectionAura(), HasIgnoreTargetResistAura(), HasIncreaseMountedFlightSpeedAura(), HasIncreaseMountedSpeedAura(), HasInterruptRegenAura(), HasInvisibilityAura(), HasInvisibilityDetectAura(), HasMountedAura(), HasNoPVPCreditAura(), HasOpenStableAura(), HasPacifyAura(), HasPacifySilenceAura(), HasPeriodicDummyAura(), HasPreventDurabilityLossAura(), HasPreventResurectionAura(), HasPreventsFleeingAura(), HasReflectSpellsAura(), HasRegenDuringCombatAura(), HasRootAura(), HasShapeshiftAura(), HasSilenceAura(), HasSpellMagnetAura(), HasSpiritOfRedemptionAura(), HasStealthAura(), HasStealthDetectAura(), HasStunAura(), HasTauntAura(), HasThreatAura(), HasTransformAura(), HasUnattackableAura(), HasWaterBreathingAura(), and HasWaterWalkAura().

◆ HasAuraTypeWithAffectMask()

bool Unit::HasAuraTypeWithAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5762{
5763 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5764 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5765 if ((*i)->IsAffectedOnSpell(affectedSpell))
5766 return true;
5767 return false;
5768}

References GetAuraEffectsByType().

Referenced by AuraEffect::CalculatePeriodic(), Spell::DoSpellHitOnUnit(), Spell::handle_immediate(), Aura::RefreshDuration(), and Aura::RefreshTimersWithMods().

◆ HasAuraTypeWithCaster()

bool Unit::HasAuraTypeWithCaster ( AuraType  auratype,
ObjectGuid  caster 
) const
5734{
5735 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5736 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5737 if (caster == (*i)->GetCasterGUID())
5738 return true;
5739 return false;
5740}

References GetAuraEffectsByType().

Referenced by BuildValuesUpdate(), IsAlwaysDetectableFor(), PatchValuesUpdate(), and ThreatContainer::SelectNextVictim().

◆ HasAuraTypeWithFamilyFlags()

bool Unit::HasAuraTypeWithFamilyFlags ( AuraType  auraType,
uint32  familyName,
uint32  familyFlags 
) const
766{
767 if (!HasAuraType(auraType))
768 return false;
769 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
770 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
771 if (SpellInfo const* iterSpellProto = (*itr)->GetSpellInfo())
772 if (iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & familyFlags)
773 return true;
774 return false;
775}

References GetAuraEffectsByType(), and HasAuraType().

◆ HasAuraTypeWithMiscvalue()

bool Unit::HasAuraTypeWithMiscvalue ( AuraType  auratype,
int32  miscvalue 
) const
5753{
5754 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5755 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5756 if (miscvalue == (*i)->GetMiscValue())
5757 return true;
5758 return false;
5759}

References GetAuraEffectsByType().

Referenced by Player::Regenerate(), Player::UpdateManaRegen(), and Player::UpdateStats().

◆ HasAuraTypeWithTriggerSpell()

bool Unit::HasAuraTypeWithTriggerSpell ( AuraType  auratype,
uint32  triggerSpell 
) const
5780{
5781 for (AuraEffect const* aura : GetAuraEffectsByType(auratype))
5782 {
5783 if (aura->GetSpellInfo()->Effects[aura->GetEffIndex()].TriggerSpell == triggerSpell)
5784 {
5785 return true;
5786 }
5787 }
5788
5789 return false;
5790}

References GetAuraEffectsByType().

Referenced by WorldSession::HandlePetActionHelper().

◆ HasAuraTypeWithValue()

bool Unit::HasAuraTypeWithValue ( AuraType  auratype,
int32  value 
) const
5771{
5772 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5773 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5774 if (value == (*i)->GetAmount())
5775 return true;
5776 return false;
5777}

References GetAuraEffectsByType().

◆ HasAuraWithMechanic()

bool Unit::HasAuraWithMechanic ( uint32  mechanicMask) const
5816{
5817 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5818 {
5819 SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo();
5820 if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
5821 return true;
5822
5823 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5824 if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
5825 if (mechanicMask & (1 << spellInfo->Effects[i].Mechanic))
5826 return true;
5827 }
5828
5829 return false;
5830}

References SpellInfo::Effects, m_appliedAuras, MAX_SPELL_EFFECTS, and SpellInfo::Mechanic.

Referenced by EarthenPowerTargetSelector::operator()(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ HasBreakableByDamageAuraType()

bool Unit::HasBreakableByDamageAuraType ( AuraType  type,
uint32  excludeAura = 0 
) const
778{
779 AuraEffectList const& auras = GetAuraEffectsByType(type);
780 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
781 if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction
782 ((*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
783 return true;
784 return false;
785}

References AURA_INTERRUPT_FLAG_TAKE_DAMAGE, and GetAuraEffectsByType().

Referenced by HasBreakableByDamageCrowdControlAura().

◆ HasBreakableByDamageCrowdControlAura()

bool Unit::HasBreakableByDamageCrowdControlAura ( Unit excludeCasterChannel = nullptr) const
788{
789 uint32 excludeAura = 0;
790 if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr)
791 excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
792
798}
@ SPELL_AURA_MOD_FEAR
Definition SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition SpellAuraDefines.h:89
@ SPELL_AURA_TRANSFORM
Definition SpellAuraDefines.h:119
@ SPELL_AURA_MOD_CONFUSE
Definition SpellAuraDefines.h:68
@ SPELL_AURA_MOD_STUN
Definition SpellAuraDefines.h:75
bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura=0) const
Definition Unit.cpp:777
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1499

References CURRENT_CHANNELED_SPELL, GetCurrentSpell(), HasBreakableByDamageAuraType(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, and SPELL_AURA_TRANSFORM.

Referenced by PetAI::CanAttack(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), CasterAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), and PetAI::UpdateAI().

◆ HasCloneCasterAura()

bool Unit::HasCloneCasterAura ( ) const
inline
@ SPELL_AURA_CLONE_CASTER
Definition SpellAuraDefines.h:310

References HasAuraType(), and SPELL_AURA_CLONE_CASTER.

Referenced by WorldSession::HandleMirrorImageDataRequest().

◆ HasConfuseAura()

bool Unit::HasConfuseAura ( ) const
inline

◆ HasControlVehicleAura()

bool Unit::HasControlVehicleAura ( ) const
inline

◆ HasDecreaseSpeedAura()

bool Unit::HasDecreaseSpeedAura ( ) const
inline

◆ HasDetectAmoreAura()

bool Unit::HasDetectAmoreAura ( ) const
inline
@ SPELL_AURA_DETECT_AMORE
Definition SpellAuraDefines.h:233

References HasAuraType(), and SPELL_AURA_DETECT_AMORE.

Referenced by AuraEffect::HandleDetectAmore().

◆ HasDetectSpellsAura()

bool Unit::HasDetectSpellsAura ( ) const
inline
@ SPELL_AURA_DEFLECT_SPELLS
Definition SpellAuraDefines.h:350

References HasAuraType(), and SPELL_AURA_DEFLECT_SPELLS.

◆ HasExtraUnitMovementFlag()

uint16 Unit::HasExtraUnitMovementFlag ( uint16  f) const
inline

◆ HasFearAura()

◆ HasFeatherFallAura()

bool Unit::HasFeatherFallAura ( ) const
inline
@ SPELL_AURA_FEATHER_FALL
Definition SpellAuraDefines.h:168

References HasAuraType(), and SPELL_AURA_FEATHER_FALL.

Referenced by Player::GetAurasForTarget(), and Player::HandleFall().

◆ HasFlyAura()

◆ HasGhostAura()

bool Unit::HasGhostAura ( ) const
inline

◆ HasHealthRegenInCombatAura()

bool Unit::HasHealthRegenInCombatAura ( ) const
inline
@ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
Definition SpellAuraDefines.h:224

References HasAuraType(), and SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT.

Referenced by Player::RegenerateAll().

◆ HasHoverAura()

bool Unit::HasHoverAura ( ) const
inline
1713{ return HasAuraType(SPELL_AURA_HOVER); };
@ SPELL_AURA_HOVER
Definition SpellAuraDefines.h:169

References HasAuraType(), and SPELL_AURA_HOVER.

Referenced by Player::GetAurasForTarget(), Player::HandleFall(), and Creature::UpdateMovementFlags().

◆ HasIgnoreHitDirectionAura()

bool Unit::HasIgnoreHitDirectionAura ( ) const
inline

◆ HasIgnoreTargetResistAura()

bool Unit::HasIgnoreTargetResistAura ( ) const
inline

◆ HasIncreaseMountedFlightSpeedAura()

◆ HasIncreaseMountedSpeedAura()

bool Unit::HasIncreaseMountedSpeedAura ( ) const
inline
@ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
Definition SpellAuraDefines.h:95

References HasAuraType(), and SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED.

◆ HasInterruptRegenAura()

bool Unit::HasInterruptRegenAura ( ) const
inline
@ SPELL_AURA_INTERRUPT_REGEN
Definition SpellAuraDefines.h:157

References HasAuraType(), and SPELL_AURA_INTERRUPT_REGEN.

Referenced by Player::Regenerate().

◆ HasInvisibilityAura()

bool Unit::HasInvisibilityAura ( ) const
inline

◆ HasInvisibilityDetectAura()

bool Unit::HasInvisibilityDetectAura ( ) const
inline
@ SPELL_AURA_MOD_INVISIBILITY_DETECT
Definition SpellAuraDefines.h:82

References HasAuraType(), and SPELL_AURA_MOD_INVISIBILITY_DETECT.

Referenced by AuraEffect::HandleModInvisibilityDetect().

◆ HasMainhandWeapon()

bool Unit::HasMainhandWeapon ( ) const
inline
933{ return HasWeapon(BASE_ATTACK); }
virtual bool HasWeapon(WeaponAttackType type) const =0

References BASE_ATTACK, and HasWeapon().

◆ hasMainhandWeaponForAttack()

bool Unit::hasMainhandWeaponForAttack ( ) const
inline
virtual bool HasWeaponForAttack(WeaponAttackType type) const
Definition Unit.h:938

References BASE_ATTACK, and HasWeaponForAttack().

◆ HasMainhandWeaponForAttack()

bool Unit::HasMainhandWeaponForAttack ( ) const
inline

◆ HasMountedAura()

◆ HasNegativeAuraWithAttribute()

bool Unit::HasNegativeAuraWithAttribute ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5805{
5806 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5807 {
5808 Aura const* aura = iter->second->GetBase();
5809 if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
5810 return true;
5811 }
5812 return false;
5813}
uint32 Attributes
Definition SpellInfo.h:324

References SpellInfo::Attributes, Aura::GetCasterGUID(), Aura::GetSpellInfo(), and m_appliedAuras.

◆ HasNegativeAuraWithInterruptFlag()

bool Unit::HasNegativeAuraWithInterruptFlag ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5793{
5794 if (!(m_interruptMask & flag))
5795 return false;
5796 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter)
5797 {
5798 if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
5799 return true;
5800 }
5801 return false;
5802}

References m_interruptableAuras, and m_interruptMask.

Referenced by ThreatContainer::SelectNextVictim().

◆ HasNoPVPCreditAura()

bool Unit::HasNoPVPCreditAura ( ) const
inline
@ SPELL_AURA_NO_PVP_CREDIT
Definition SpellAuraDefines.h:222

References HasAuraType(), and SPELL_AURA_NO_PVP_CREDIT.

Referenced by Player::RewardHonor().

◆ HasNpcFlag()

bool Unit::HasNpcFlag ( NPCFlags  flags) const
inline

◆ HasOffhandWeapon()

bool Unit::HasOffhandWeapon ( ) const
inline
934{ return HasWeapon(OFF_ATTACK); }

References HasWeapon(), and OFF_ATTACK.

◆ HasOffhandWeaponForAttack()

◆ HasOpenStableAura()

bool Unit::HasOpenStableAura ( ) const
inline
@ SPELL_AURA_OPEN_STABLE
Definition SpellAuraDefines.h:355

References HasAuraType(), and SPELL_AURA_OPEN_STABLE.

◆ HasPacifyAura()

bool Unit::HasPacifyAura ( ) const
inline
@ SPELL_AURA_MOD_PACIFY
Definition SpellAuraDefines.h:88

References HasAuraType(), and SPELL_AURA_MOD_PACIFY.

Referenced by AuraEffect::HandleAuraModPacify(), and WorldSession::HandlePetActionHelper().

◆ HasPacifySilenceAura()

bool Unit::HasPacifySilenceAura ( ) const
inline

◆ HasPeriodicDummyAura()

bool Unit::HasPeriodicDummyAura ( ) const
inline

◆ HasPreventDurabilityLossAura()

bool Unit::HasPreventDurabilityLossAura ( ) const
inline
@ SPELL_AURA_PREVENT_DURABILITY_LOSS
Definition SpellAuraDefines.h:352

References HasAuraType(), and SPELL_AURA_PREVENT_DURABILITY_LOSS.

Referenced by Player::DurabilityPointsLoss().

◆ HasPreventResurectionAura()

bool Unit::HasPreventResurectionAura ( ) const
inline

◆ HasPreventsFleeingAura()

bool Unit::HasPreventsFleeingAura ( ) const
inline
@ SPELL_AURA_PREVENTS_FLEEING
Definition SpellAuraDefines.h:155

References HasAuraType(), and SPELL_AURA_PREVENTS_FLEEING.

Referenced by Creature::DoFleeToGetAssistance().

◆ HasRangedWeapon()

bool Unit::HasRangedWeapon ( ) const
inline
935{ return HasWeapon(RANGED_ATTACK); }

References HasWeapon(), and RANGED_ATTACK.

◆ HasRangedWeaponForAttack()

bool Unit::HasRangedWeaponForAttack ( ) const
inline

◆ HasReflectSpellsAura()

bool Unit::HasReflectSpellsAura ( ) const
inline
@ SPELL_AURA_REFLECT_SPELLS
Definition SpellAuraDefines.h:91

References HasAuraType(), and SPELL_AURA_REFLECT_SPELLS.

Referenced by Spell::DoSpellHitOnUnit().

◆ HasRegenDuringCombatAura()

bool Unit::HasRegenDuringCombatAura ( ) const
inline
@ SPELL_AURA_MOD_REGEN_DURING_COMBAT
Definition SpellAuraDefines.h:179

References HasAuraType(), and SPELL_AURA_MOD_REGEN_DURING_COMBAT.

Referenced by Player::RegenerateAll(), and Player::RegenerateHealth().

◆ HasRootAura()

bool Unit::HasRootAura ( ) const
inline

◆ HasShapeshiftAura()

bool Unit::HasShapeshiftAura ( ) const
inline

◆ HasSharedVision()

◆ HasSilenceAura()

bool Unit::HasSilenceAura ( ) const
inline

◆ HasSpell()

virtual bool Unit::HasSpell ( uint32  ) const
inlinevirtual

◆ HasSpellCooldown()

◆ HasSpellItemCooldown()

virtual bool Unit::HasSpellItemCooldown ( uint32  ,
uint32   
) const
inlinevirtual

Reimplemented in Player.

1267{ return false; }

Referenced by Spell::CheckCast(), and ProcDamageAndSpellFor().

◆ HasSpellMagnetAura()

bool Unit::HasSpellMagnetAura ( ) const
inline

◆ HasSpiritOfRedemptionAura()

◆ HasStealthAura()

◆ HasStealthDetectAura()

bool Unit::HasStealthDetectAura ( ) const
inline
@ SPELL_AURA_MOD_STEALTH_DETECT
Definition SpellAuraDefines.h:80

References HasAuraType(), and SPELL_AURA_MOD_STEALTH_DETECT.

Referenced by AuraEffect::HandleModStealthDetect().

◆ HasStunAura()

bool Unit::HasStunAura ( ) const
inline

◆ HasTauntAura()

bool Unit::HasTauntAura ( ) const
inline
@ SPELL_AURA_MOD_TAUNT
Definition SpellAuraDefines.h:74

References HasAuraType(), and SPELL_AURA_MOD_TAUNT.

Referenced by Creature::CanCreatureAttack(), and PetAI::SelectNextTarget().

◆ HasThreatAura()

bool Unit::HasThreatAura ( ) const
inline
@ SPELL_AURA_MOD_THREAT
Definition SpellAuraDefines.h:73

References HasAuraType(), and SPELL_AURA_MOD_THREAT.

Referenced by ApplyTotalThreatModifier().

◆ HasTransformAura()

bool Unit::HasTransformAura ( ) const
inline

◆ HasUnattackableAura()

bool Unit::HasUnattackableAura ( ) const
inline

◆ HasUnitFlag()

bool Unit::HasUnitFlag ( UnitFlags  flags) const
inline
718{ return HasFlag(UNIT_FIELD_FLAGS, flags); }

References flags, Object::HasFlag(), and UNIT_FIELD_FLAGS.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), Vehicle::AddPassenger(), AttackerStateUpdate(), boss_malygos::boss_malygosAI::AttackStart(), SmartAI::AttackStart(), npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), violet_hold_trashAI::AttackStart(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::AttackStart(), npc_ravenous_worg::npc_ravenous_worgAI::AttackStart(), npc_swarm_scarab::npc_swarm_scarabAI::CanAIAttack(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanNoReagentCast(), CanSwim(), CanUseAttackType(), Spell::CheckEffectTarget(), boss_muru::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_jormungarAI::DoAction(), Spell::DoSpellHitOnUnit(), RandomMovementGenerator< T >::DoUpdate(), boss_dorothee::EnterEvadeMode(), boss_roar::EnterEvadeMode(), boss_strawman::EnterEvadeMode(), boss_tinhead::EnterEvadeMode(), boss_julianne::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GetReactionTo(), GetVelocity(), spell_gen_model_visible::HandleEffectApply(), WorldSession::HandleMovementOpcodes(), spell_gen_mounted_charge::HandleScriptEffect(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsMounted(), IsPetInCombat(), isTargetableForAttack(), violet_hold_trashAI::JustEngagedWith(), boss_novos::boss_novosAI::JustSummoned(), Condition::Meets(), MotionMaster::MoveCharge(), MotionMaster::MoveChase(), MotionMaster::MoveConfused(), MotionMaster::MoveDistract(), MotionMaster::MoveFall(), MotionMaster::MoveFleeing(), MotionMaster::MoveFollow(), boss_professor_putricide::boss_professor_putricideAI::MoveInLineOfSight(), boss_palehoof::boss_palehoofAI::MoveInLineOfSight(), npc_massive_jormungar::npc_massive_jormungarAI::MoveInLineOfSight(), npc_ferocious_rhino::npc_ferocious_rhinoAI::MoveInLineOfSight(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::MoveInLineOfSight(), npc_frenzied_worgen::npc_frenzied_worgenAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), npc_nether_drake::npc_nether_drakeAI::MoveInLineOfSight(), MotionMaster::MoveLand(), MotionMaster::MovePath(), MotionMaster::MovePoint(), MotionMaster::MoveRandom(), MotionMaster::MoveSeekAssistance(), MotionMaster::MoveSeekAssistanceDistract(), MotionMaster::MoveSplinePath(), MotionMaster::MoveTakeoff(), MotionMaster::MoveTargetedHome(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::myCanCast(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::RefreshSwimmingFlag(), ScriptedAI::SelectSpell(), Player::SetClientControl(), SetSpeed(), boss_the_lurker_below::SummonedCreatureDies(), Player::Update(), npc_onyxian_lair_guard::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_xt002_heart::npc_xt002_heartAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_ravenous_worg::npc_ravenous_worgAI::UpdateAI(), and Player::UpdateTriggerVisibility().

◆ HasUnitFlag2()

◆ HasUnitMovementFlag()

◆ HasUnitState()

bool Unit::HasUnitState ( const uint32  f) const
inline
707{ return (m_state & f); }

References m_state.

Referenced by Spell::_cast(), Creature::_IsTargetAcceptable(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), AddThreat(), advisor_baseAI::advisor_baseAI(), Attack(), AttackerStateUpdate(), FollowerAI::AttackStart(), npc_raging_spirit::npc_raging_spiritAI::AttackStart(), boss_alar::boss_alar(), boss_anetheron::boss_anetheron(), boss_anzu::boss_anzu(), boss_apothecary_hummel::boss_apothecary_hummelAI::boss_apothecary_hummelAI(), boss_archimonde::boss_archimonde(), boss_azgalor::boss_azgalor(), boss_azuregos::boss_azuregosAI::boss_azuregosAI(), boss_balinda::boss_balinda(), boss_bigbadwolf::boss_bigbadwolf(), boss_blackheart_the_inciter::boss_blackheart_the_inciter(), boss_blindeye_the_seer::boss_blindeye_the_seer(), boss_captain_skarloc::boss_captain_skarloc(), boss_curator::boss_curator(), boss_darkweaver_syth::boss_darkweaver_syth(), boss_dorothee::boss_dorothee(), boss_exarch_maladaar::boss_exarch_maladaar(), boss_fathomguard_caribdis::boss_fathomguard_caribdis(), boss_fathomguard_sharkkis::boss_fathomguard_sharkkis(), boss_fathomguard_tidalvess::boss_fathomguard_tidalvess(), boss_ghazan::boss_ghazan(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurse(), boss_halazzi::boss_halazzi(), boss_hexlord_malacrass::boss_hexlord_malacrass(), boss_high_astromancer_solarian::boss_high_astromancer_solarian(), boss_high_king_maulgar::boss_high_king_maulgar(), boss_janalai::boss_janalai(), boss_jarien::boss_jarien(), boss_kazrogal::boss_kazrogal(), boss_kelidan_the_breaker::boss_kelidan_the_breaker(), boss_kiggler_the_crazed::boss_kiggler_the_crazed(), boss_krosh_firehand::boss_krosh_firehand(), boss_lady_vashj::boss_lady_vashj(), boss_magtheridon::boss_magtheridon(), boss_maiden_of_virtue::boss_maiden_of_virtue(), boss_mekgineer_steamrigger::boss_mekgineer_steamrigger(), boss_mennu_the_betrayer::boss_mennu_the_betrayer(), boss_mor_grayhoof::boss_mor_grayhoof(), boss_moroes::boss_moroes(), boss_morogrim_tidewalker::boss_morogrim_tidewalker(), boss_murmur::boss_murmur(), boss_nazan::boss_nazan(), boss_nexusprince_shaffar::boss_nexusprince_shaffar(), boss_olm_the_summoner::boss_olm_the_summoner(), boss_omor_the_unscarred::boss_omor_the_unscarred(), boss_pandemonius::boss_pandemonius(), boss_quagmirran::boss_quagmirran(), boss_rage_winterchill::boss_rage_winterchill(), boss_roar::boss_roar(), boss_rokmar_the_crackler::boss_rokmar_the_crackler(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcher(), boss_sothos::boss_sothos(), boss_strawman::boss_strawman(), boss_supremus::boss_supremus(), boss_swamplord_muselek::boss_swamplord_muselek(), boss_talon_king_ikiss::boss_talon_king_ikiss(), boss_tavarok::boss_tavarok(), boss_terestian_illhoof::boss_terestian_illhoof(), boss_the_black_stalker::boss_the_black_stalker(), boss_the_maker::boss_the_maker(), boss_tinhead::boss_tinhead(), boss_vazruden::boss_vazruden(), boss_void_reaver::boss_void_reaver(), boss_warbringer_omrogg::boss_warbringer_omrogg(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefist(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmar(), PathGenerator::CalculatePath(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), boss_gurtogg_bloodboil::CanAIAttack(), PetAI::CanAttack(), Player::CanEquipItem(), CanFreeMove(), Creature::CanPeriodicallyCallForAssistance(), Creature::CanStartAttack(), spell_dk_death_grip::CheckCast(), Spell::CheckCast(), Spell::CheckPetCast(), spell_warr_retaliation::CheckProc(), SpellInfo::CheckTarget(), CreatureUnitRelocationWorker(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), DealDamage(), DealMeleeDamage(), DisableRotate(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), Spell::DoSpellHitOnUnit(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectDistract(), Spell::EffectEnergize(), Spell::EffectHealMaxHealth(), Spell::EffectKnockBack(), CritterAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Spell::finish(), Player::GetInitialVisiblePackets(), WorldSession::HandleAuctionListItems(), spell_dru_starfall_dummy::HandleDummy(), WorldSession::HandleEmoteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleMoveTeleportAck(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), AuraEffect::HandleProcTriggerDamageAuraProc(), ArenaSpectator::HandleSpectatorSpectateCommand(), boss_venoxis::InitializeAI(), isAttackingPlayer(), boss_faction_championsAI::IsCCed(), Creature::IsInEvadeMode(), IsInFlight(), IsMovementPreventedByCasting(), Creature::IsMovementPreventedByCasting(), isPossessed(), isPossessedByPlayer(), isSpellBlocked(), IsStopped(), isTargetableForAttack(), IsValidCombatTarget(), CritterAI::JustEngagedWith(), boss_priestess_delrissa::JustEngagedWith(), npc_coren_direbrew_sisters::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), boss_essence_of_desire::boss_essence_of_desireAI::JustEngagedWith(), boss_priestess_lackey_commonAI::JustEngagedWith(), boss_kagani_nightstrike::JustEngagedWith(), PetAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), LoadHelper(), MagicSpellHitResult(), MeleeSpellHitResult(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_kaelthas::MovementInform(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_hunter::npc_toc_hunterAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_warrior::npc_toc_warriorAI::myCanCast(), npc_toc_dk::npc_toc_dkAI::myCanCast(), npc_toc_rogue::npc_toc_rogueAI::myCanCast(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::myCanCast(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::myCanCast(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_apothecary_baxter::npc_apothecary_baxter(), npc_batrider::npc_batrider(), npc_hyjal_frost_wyrm::npc_hyjal_frost_wyrm(), npc_hyjal_gargoyle::npc_hyjal_gargoyle(), npc_hyjal_ground_trash::npc_hyjal_ground_trash(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrm(), npc_inner_demon::npc_inner_demon(), npc_kiljaeden_controller::npc_kiljaeden_controller(), Acore::FriendlyCCedInRange::operator()(), SmartScript::ProcessAction(), RemoveCharmedBy(), boss_kormok::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), npc_ohgan::npc_ohganAI::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_isalien::Reset(), npc_anubisath_guardian::Reset(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::Reset(), npc_ashtongue_channeler::Reset(), RollMeleeOutcomeAgainst(), boss_faction_championsAI::SelectEnemyCaster(), Player::SetClientControl(), SetContestedPvP(), SetControlled(), Creature::SetDisableGravity(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Creature::SetHover(), SetInCombatState(), SetInFront(), SetRooted(), SetStunned(), WaypointMovementGenerator< Creature >::StartMove(), lfg::LFGMgr::TeleportPlayer(), CreatureAI::TriggerAlert(), Player::Update(), Update(), TimedFleeingMovementGenerator::Update(), boss_sartharion_dragonAI::UpdateAI(), CombatAI::UpdateAI(), CasterAI::UpdateAI(), BossAI::UpdateAI(), WorldBossAI::UpdateAI(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::UpdateAI(), ironhand_guardian::ironhand_guardianAI::UpdateAI(), boss_anubshiah::boss_anubshiahAI::UpdateAI(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::UpdateAI(), boss_eviscerator::boss_evisceratorAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_moira_bronzebeardAI::UpdateAI(), boss_high_priestess_thaurissanAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_halycon::boss_halyconAI::UpdateAI(), boss_highlord_omokk::boss_highlordomokkAI::UpdateAI(), boss_lord_valthalak::boss_lord_valthalakAI::UpdateAI(), boss_overlord_wyrmthalak::boss_overlordwyrmthalakAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_solakar_flamewreath::boss_solakar_flamewreathAI::UpdateAI(), boss_the_beast::boss_thebeastAI::UpdateAI(), boss_urok_doomhowl::boss_urok_doomhowlAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_chromaggus::boss_chromaggusAI::UpdateAI(), boss_ebonroc::boss_ebonrocAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_nefarian::UpdateAI(), boss_razorgore::boss_razorgoreAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_garr::boss_garrAI::UpdateAI(), boss_golemagg::boss_golemaggAI::UpdateAI(), npc_core_rager::npc_core_ragerAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_flamewaker_priest::npc_flamewaker_priestAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), boss_netherspite::UpdateAI(), boss_servant_quarters::UpdateAI(), npc_kilrek::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), boss_blight_worm::boss_blight_wormAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), npc_hallows_end_soh::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), boss_onyxia::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_volazj::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), npc_rotting_frost_giant::npc_rotting_frost_giantAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_captain_arnath::npc_captain_arnathAI::UpdateAI(), npc_captain_brandon::npc_captain_brandonAI::UpdateAI(), npc_captain_grondel::npc_captain_grondelAI::UpdateAI(), npc_captain_rupert::npc_captain_rupertAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razuvious_minion::boss_razuvious_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir::boss_sjonnirAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), boss_dalronn_the_controller::UpdateAI(), npc_enslaved_proto_drake::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_exarch_maladaar::UpdateAI(), boss_nexusprince_shaffar::UpdateAI(), npc_yor::UpdateAI(), boss_anzu::UpdateAI(), npc_maiev_illidan::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_high_nethermancer_zerevor::UpdateAI(), boss_lady_malande::UpdateAI(), boss_veras_darkshadow::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_doomlord_kazzak::boss_doomlordkazzakAI::UpdateAI(), boss_doomwalker::UpdateAI(), boss_leotheras_the_blind::UpdateAI(), boss_gruul::UpdateAI(), boss_the_maker::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), boss_watchkeeper_gargolmar::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_alar::UpdateAI(), advisor_baseAI::UpdateAI(), npc_maghar_captive::npc_maghar_captiveAI::UpdateAI(), npc_enslaved_netherwing_drake::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), emerald_dragonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), PetAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI(), npc_wg_spirit_guide::npc_wg_spirit_guideAI::UpdateAI(), Player::UpdateCharmedAI(), npc_general_andorov::UpdateEscortAI(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), npc_kurenai_captive::npc_kurenai_captiveAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), SmartAI::UpdatePath(), and SmartScript::UpdateTimer().

◆ HasUnitTypeMask()

◆ HasVisibleAuraType()

bool Unit::HasVisibleAuraType ( AuraType  auraType) const
5743{
5744 AuraEffectList const& mAuraList = GetAuraEffectsByType(auraType);
5745 for (AuraEffectList::const_iterator i = mAuraList.begin(); i != mAuraList.end(); ++i)
5746 if ((*i)->GetBase()->CanBeSentToClient())
5747 return true;
5748
5749 return false;
5750}

References GetAuraEffectsByType().

◆ HasWaterBreathingAura()

bool Unit::HasWaterBreathingAura ( ) const
inline
@ SPELL_AURA_WATER_BREATHING
Definition SpellAuraDefines.h:145

References HasAuraType(), and SPELL_AURA_WATER_BREATHING.

Referenced by Player::getMaxTimer().

◆ HasWaterWalkAura()

bool Unit::HasWaterWalkAura ( ) const
inline
@ SPELL_AURA_WATER_WALK
Definition SpellAuraDefines.h:167

References HasAuraType(), and SPELL_AURA_WATER_WALK.

Referenced by Player::GetAurasForTarget().

◆ HasWeapon()

virtual bool Unit::HasWeapon ( WeaponAttackType  type) const
pure virtual

Implemented in Creature, and Player.

Referenced by HasMainhandWeapon(), HasOffhandWeapon(), and HasRangedWeapon().

◆ HasWeaponForAttack()

virtual bool Unit::HasWeaponForAttack ( WeaponAttackType  type) const
inlinevirtual

Reimplemented in Creature, and Player.

938{ return CanUseAttackType(type); }
bool CanUseAttackType(uint8 attacktype) const
Definition Unit.h:942

References CanUseAttackType().

Referenced by hasMainhandWeaponForAttack(), HasMainhandWeaponForAttack(), HasOffhandWeaponForAttack(), HasRangedWeaponForAttack(), Creature::HasWeaponForAttack(), and Player::HasWeaponForAttack().

◆ haveOffhandWeapon()

bool Unit::haveOffhandWeapon ( ) const
522{
523 if (Player const* player = ToPlayer())
524 return player->GetWeaponForAttack(OFF_ATTACK, true);
525
526 return CanDualWield();
527}
bool CanDualWield() const
Definition Unit.h:929

References CanDualWield(), OFF_ATTACK, and Object::ToPlayer().

Referenced by boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), and boss_twin_valkyrAI::myDoMeleeAttackIfReady().

◆ HealBySpell()

int32 Unit::HealBySpell ( HealInfo healInfo,
bool  critical = false 
)
11268{
11269 uint32 heal = healInfo.GetHeal();
11270 sScriptMgr->ModifyHealReceived(this, healInfo.GetTarget(), heal, healInfo.GetSpellInfo());
11271 healInfo.SetHeal(heal);
11272
11273 // calculate heal absorb and reduce healing
11274 CalcHealAbsorb(healInfo);
11275
11276 int32 gain = Unit::DealHeal(healInfo.GetHealer(), healInfo.GetTarget(), healInfo.GetHeal());
11277 healInfo.SetEffectiveHeal(gain);
11278
11279 SendHealSpellLog(healInfo, critical);
11280 return gain;
11281}
Unit * GetHealer() const
Definition Unit.h:410
void SetHeal(uint32 amount)
Definition Unit.h:400
void SetEffectiveHeal(uint32 amount)
Definition Unit.h:405
static void CalcHealAbsorb(HealInfo &healInfo)
Definition Unit.cpp:2502
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition Unit.cpp:10974
void SendHealSpellLog(HealInfo const &healInfo, bool critical=false)
Definition Unit.cpp:11250

References CalcHealAbsorb(), DealHeal(), HealInfo::GetHeal(), HealInfo::GetHealer(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SendHealSpellLog(), HealInfo::SetEffectiveHeal(), HealInfo::SetHeal(), and sScriptMgr.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ HealthAbovePct()

◆ HealthAbovePctHealed()

bool Unit::HealthAbovePctHealed ( int32  pct,
uint32  heal 
) const
inline

◆ HealthBelowPct()

bool Unit::HealthBelowPct ( int32  pct) const
inline
1043{ return GetHealth() < CountPctFromMaxHealth(pct); }

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_moira_bronzebeardAI::CastOnEmperorIfPossible(), boss_mor_grayhoof::DamageTaken(), boss_isalien::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::DamageTaken(), boss_hadronox::boss_hadronoxAI::DamageTaken(), HandleDummyAuraProc(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), HandleProcTriggerSpell(), ScriptedAI::HealthBelowPct(), boss_kalec::JustEngagedWith(), boss_sathrovarr::JustEngagedWith(), npc_akama_illidan::JustEngagedWith(), npc_maiev_illidan::JustEngagedWith(), boss_olm_the_summoner::JustEngagedWith(), boss_priestess_lackey_commonAI::JustEngagedWith(), boss_yazzai::JustEngagedWith(), boss_grand_warlock_nethekurse::JustEngagedWith(), Player::LoadFromDB(), npc_death_knight_initiate::OnGossipHello(), SetHealth(), SpellPctHealingModsDone(), Update(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_anomalus::UpdateAI(), boss_keristrasza::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_ormorok::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), and npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI().

◆ HealthBelowPctDamaged()

bool Unit::HealthBelowPctDamaged ( int32  pct,
uint32  damage 
) const
inline
1044{ return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
std::int64_t int64
Definition Define.h:102

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_mandokir::boss_mandokirAI::DamageDealt(), boss_lord_valthalak::boss_lord_valthalakAI::DamageTaken(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::DamageTaken(), boss_quartermaster_zigris::DamageTaken(), boss_warmaster_voone::boss_warmastervooneAI::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_golemagg::boss_golemaggAI::DamageTaken(), npc_core_rager::npc_core_ragerAI::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_kormok::DamageTaken(), npc_batrider::DamageTaken(), npc_coren_direbrew::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_onyxia::DamageTaken(), npc_anubisath_guardian::DamageTaken(), boss_ouro::DamageTaken(), npc_anubisath_sentinel::aqsentinelAI::DamageTaken(), npc_anubisath_defender::DamageTaken(), boss_elder_nadox::DamageTaken(), boss_volazj::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), npc_xt002_boombot::npc_xt002_boombotAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_akama_shade::DamageTaken(), boss_vazruden::DamageTaken(), npc_millhouse_manastorm::npc_millhouse_manastormAI::DamageTaken(), npc_magister_aledis::DamageTaken(), BossAI::DamageTaken(), boss_buru::DamageTaken(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), boss_bug_trio::DamageTaken(), boss_hadronox::boss_hadronoxAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), and HandleProcTriggerSpell().

◆ IncrDiminishing()

void Unit::IncrDiminishing ( DiminishingGroup  group)
15057{
15058 // Checking for existing in the table
15059 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
15060 {
15061 if (i->DRGroup != group)
15062 continue;
15063 if (int32(i->hitCount) < GetDiminishingReturnsMaxLevel(group))
15064 i->hitCount += 1;
15065 return;
15066 }
15068}
DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
Definition SpellMgr.cpp:264
Definition Unit.h:272

References DIMINISHING_LEVEL_2, GetDiminishingReturnsMaxLevel(), GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ InitCharmInfo()

CharmInfo * Unit::InitCharmInfo ( )
15835{
15836 if (!m_charmInfo)
15837 m_charmInfo = new CharmInfo(this);
15838
15839 return m_charmInfo;
15840}
Definition CharmInfo.h:127

References m_charmInfo.

Referenced by Guardian::Guardian(), Pet::Pet(), and SetCharmedBy().

◆ InitStatBuffMods()

void Unit::InitStatBuffMods ( )
inline
1013 {
1014 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + i, 0);
1015 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + i, 0);
1016 }

References STAT_STRENGTH, UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::InitStatsForLevel().

◆ InitTamedPet()

bool Unit::InitTamedPet ( Pet pet,
uint8  level,
uint32  spell_id 
)
17419{
17420 Player* player = ToPlayer();
17421 PetStable& petStable = player->GetOrInitPetStable();
17422 if (petStable.CurrentPet || petStable.GetUnslottedHunterPet())
17423 return false;
17424
17425 pet->SetCreatorGUID(GetGUID());
17426 pet->SetFaction(GetFaction());
17427 pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
17428
17429 if (IsPlayer())
17431
17432 if (!pet->InitStatsForLevel(level))
17433 {
17434 LOG_ERROR("entities.unit", "Pet::InitStatsForLevel() failed for creature (Entry: {})!", pet->GetEntry());
17435 return false;
17436 }
17437
17438 pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
17439 // this enables pet details window (Shift+P)
17440 pet->InitPetCreateSpells();
17441 pet->SetFullHealth();
17442 pet->FillPetInfo(&petStable.CurrentPet.emplace());
17443 return true;
17444}
@ UNIT_CREATED_BY_SPELL
Definition UpdateFields.h:138
bool InitStatsForLevel(uint8 level)
Definition Pet.cpp:1015
Definition PetDefines.h:206
PetInfo const * GetUnslottedHunterPet() const
Definition PetDefines.h:234
Optional< PetInfo > CurrentPet
Definition PetDefines.h:229
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition Pet.cpp:2468
void InitPetCreateSpells()
Definition Pet.cpp:2043
PetStable & GetOrInitPetStable()
Definition Player.cpp:15614
void SetFullHealth()
Definition Unit.h:1053
void SetFaction(uint32 faction)
Definition Unit.cpp:10079
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition Unit.h:721
CharmInfo * GetCharmInfo()
Definition Unit.h:1212
void SetCreatorGUID(ObjectGuid creator)
Definition Unit.h:687
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition CharmInfo.cpp:240

References PetStable::CurrentPet, Pet::FillPetInfo(), GetCharmInfo(), Object::GetEntry(), GetFaction(), Object::GetGUID(), Player::GetOrInitPetStable(), PetStable::GetUnslottedHunterPet(), Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), Object::IsPlayer(), LOG_ERROR, ReplaceAllUnitFlags(), SetCreatorGUID(), SetFaction(), SetFullHealth(), CharmInfo::SetPetNumber(), SetUInt32Value(), sObjectMgr, Object::ToPlayer(), UNIT_CREATED_BY_SPELL, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by CreateTamedPetFrom(), and CreateTamedPetFrom().

◆ InterruptNonMeleeSpells()

void Unit::InterruptNonMeleeSpells ( bool  withDelayed,
uint32  spellid = 0,
bool  withInstant = true,
bool  bySelf = false 
)
4130{
4131 // generic spells are interrupted if they are not finished or delayed
4132 if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
4133 InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, bySelf);
4134
4135 // autorepeat spells are interrupted if they are not finished or delayed
4136 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
4137 InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, bySelf);
4138
4139 // channeled spells are interrupted if they are not finished, even if they are delayed
4140 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
4141 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4142}

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, InterruptSpell(), and m_currentSpells.

Referenced by _EnterVehicle(), PetAI::_stopAttack(), Player::ActivateSpec(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), CleanupBeforeRemoveFromMap(), CombatStop(), boss_julianne::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_onyxia::DamageTaken(), boss_volazj::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DamageTaken(), DealDamage(), boss_leotheras_the_blind::DemonTime(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_akilzon::DoAction(), npc_medivh_bm::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), boss_nazan::DoAction(), npc_ranshalla::npc_ranshallaAI::DoContinueEscort(), Spell::EffectKnockBack(), boss_leotheras_the_blind::ElfTime(), boss_felblood_kaelthas::GravityLapseSequence(), spell_dk_death_grip::HandleBaseDummy(), WorldSession::HandleCancelCastOpcode(), spell_magtheridon_shadow_grasp::HandleDummyRemove(), spell_novos_crystal_handler_death_aura::HandleEffectApply(), spell_hydross_cleansing_field_command::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLootOpcode(), WorldSession::HandlePetActionHelper(), spell_the_lich_king_jump::HandleScript(), boss_shade_of_aran::JustEngagedWith(), npc_kilrek::JustEngagedWith(), boss_archimonde::JustEngagedWith(), boss_infinite_corruptor::boss_infinite_corruptorAI::JustEngagedWith(), boss_taldaram::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_curator::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustEngagedWith(), boss_gal_darah::boss_gal_darahAI::JustEngagedWith(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustEngagedWith(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustEngagedWith(), violet_hold_trashAI::JustEngagedWith(), PetAI::KilledUnit(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_shade_of_aran::OnPowerUpdate(), boss_jeklik::PathEndReached(), npc_akama_illidan::PathEndReached(), PretendToDie(), boss_alar::PretendToDie(), SmartScript::ProcessAction(), RemoveAurasWithInterruptFlags(), boss_curator::Reset(), boss_malchezaar::Reset(), boss_varos::boss_varosAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_talon_king_ikiss::Reset(), boss_high_astromancer_solarian::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), boss_illidan_stormrage::ScheduleAbilities(), boss_the_lurker_below::SchedulerPhaseOne(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), boss_anomalus::SetData(), setDeathState(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), StopAttackFaction(), Player::TeleportTo(), CasterAI::UpdateAI(), TotemAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and PetAI::UpdateAI().

◆ InterruptSpell()

void Unit::InterruptSpell ( CurrentSpellTypes  spellType,
bool  withDelayed = true,
bool  withInstant = true,
bool  bySelf = false 
)
4061{
4062 //LOG_DEBUG("entities.unit", "Interrupt spell for unit {}.", GetEntry());
4063 Spell* spell = m_currentSpells[spellType];
4064 if (spell
4065 && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
4066 && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only)
4067 {
4068 // for example, do not let self-stun aura interrupt itself
4069 if (!spell->IsInterruptable())
4070 return;
4071
4072 // send autorepeat cancel message for autorepeat spells
4073 if (spellType == CURRENT_AUTOREPEAT_SPELL)
4074 if (IsPlayer())
4076
4077 if (spell->getState() != SPELL_STATE_FINISHED)
4078 spell->cancel(bySelf);
4079 else
4080 {
4081 m_currentSpells[spellType] = nullptr;
4082 spell->SetReferencedFromCurrent(false);
4083 }
4084 }
4085}
@ SPELL_STATE_DELAYED
Definition Spell.h:231
void SendAutoRepeatCancel(Unit *target)
Definition PlayerMisc.cpp:152
bool IsInterruptable() const
Definition Spell.h:564
int32 GetCastTime() const
Definition Spell.h:550
uint32 getState() const
Definition Spell.h:485
void cancel(bool bySelf=false)
Definition Spell.cpp:3723

References Spell::cancel(), CURRENT_AUTOREPEAT_SPELL, Spell::GetCastTime(), Spell::getState(), Spell::IsInterruptable(), Object::IsPlayer(), m_currentSpells, Player::SendAutoRepeatCancel(), Spell::SetReferencedFromCurrent(), SPELL_STATE_CASTING, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, and Object::ToPlayer().

Referenced by _UpdateAutoRepeatSpell(), Player::ActivateTaxiPathTo(), Attack(), AttackStop(), CastStop(), Spell::EffectInterruptCast(), Spell::EffectSanctuary(), AuraEffect::HandleAuraModSilence(), WorldSession::HandleCancelAuraOpcode(), WorldSession::HandleCancelAutoRepeatSpellOpcode(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleCancelChanneling(), spell_hun_scatter_shot::HandleDummy(), AuraEffect::HandleFeignDeath(), InterruptNonMeleeSpells(), SmartAI::JustEngagedWith(), Player::RemoveItemDependentAurasAndCasts(), SetCurrentCastedSpell(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_nightbane::TriggerHealthTakeOff(), and npc_belnistrasz::npc_belnistraszAI::UpdateAI().

◆ InvalidateValuesUpdateCache()

void Unit::InvalidateValuesUpdateCache ( )
inlineprivate
2138{ _valuesUpdateCache.clear(); }

References _valuesUpdateCache.

Referenced by SetUInt32Value(), and Update().

◆ IsAlive()

bool Unit::IsAlive ( ) const
inline
1704{ return (m_deathState == DeathState::Alive); };

References Alive, and m_deathState.

Referenced by _CreateAuraApplication(), CreatureAI::_EnterEvadeMode(), _EnterVehicle(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::_LoadItem(), BossAI::_Reset(), WorldBossAI::_Reset(), KillRewarder::_RewardHonor(), KillRewarder::_RewardKillCredit(), KillRewarder::_RewardXP(), PetAI::_stopAttack(), AddAura(), Map::AddPlayerToMap(), HostileReference::AddThreat(), Spell::AddUnitTarget(), Attack(), PetAI::AttackedBy(), AttackerStateUpdate(), boss_freya::boss_freyaAI::boss_freyaAI(), boss_hodir::boss_hodirAI::boss_hodirAI(), boss_mimiron::boss_mimironAI::boss_mimironAI(), boss_thorim::boss_thorimAI::boss_thorimAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), Player::BuyItemFromVendorSlot(), CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanCaptureTowerPoint(), CanHaveThreatList(), Player::CanInteractWithQuestGiver(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CanUseItem(), Player::CastItemCombatSpell(), Player::CheckAreaExploreAndOutdoor(), spell_dk_raise_ally::CheckCast(), spell_hun_check_pet_los::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), BattlegroundRV::CheckPositionForUnit(), spell_mage_focus_magic::CheckProc(), spell_dk_blood_caked_blade::CheckProc(), spell_dk_dancing_rune_weapon::CheckProc(), spell_item_necrotic_touch::CheckProc(), spell_pal_seal_of_righteousness::CheckProc(), spell_warl_siphon_life::CheckProc(), spell_putricide_mutation_init::CheckRequirementInternal(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CreatureUnitRelocationWorker(), DealDamage(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), Creature::DisappearAndDie(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_xerestrasza::npc_xerestraszaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), boss_high_king_maulgar::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), boss_tharon_ja::boss_tharon_jaAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::DoAllEffectOnTarget(), spell_hun_masters_call::DoCheckCast(), RandomMovementGenerator< T >::DoInitialize(), WorldSession::DoLootRelease(), WaypointMovementGenerator< Creature >::DoUpdate(), instance_blackrock_spire::instance_blackrock_spireMapScript::Dragonspireroomcheck(), Spell::EffectAddExtraAttacks(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectEnvironmentalDMG(), Spell::EffectFeedPet(), Spell::EffectHeal(), Spell::EffectHealMaxHealth(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), Spell::EffectHealthLeech(), Spell::EffectInstaKill(), Spell::EffectInterruptCast(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectResurrect(), Spell::EffectResurrectNew(), Spell::EffectResurrectPet(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSelfResurrect(), Spell::EffectSkinPlayerCorpse(), Spell::EffectStuck(), Spell::EffectThreat(), Spell::EffectWeaponDmg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Player::EnvironmentalDamage(), Player::EquipItem(), BattleExperienceEvent::Execute(), DelayedMovementEvent::Execute(), IceTombSummonEvent::Execute(), SACActivateEvent::Execute(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::ExecuteEvent(), AssistanceMovementGenerator::Finalize(), Creature::ForcedDespawn(), CreatureGroup::FormationReset(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::GetData(), GetDebugInfo(), Player::GetInitialVisiblePackets(), FollowerAI::GetLeaderForFollower(), Player::getMaxTimer(), CreatureGroup::GetNewTargetForMember(), Player::GetNPCIfCanInteractWith(), GetPartyMembers(), npc_air_force_bots::npc_air_force_botsAI::GetSummonedGuard(), npc_wild_wyrm::npc_wild_wyrmAI::GetValidPlayer(), Pet::GivePetXP(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipSelect(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), BattlegroundEY::HandleAreaTrigger(), BattlegroundWS::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModTotalThreat(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), HandleDummyAuraProc(), WorldSession::HandleEmoteOpcode(), Player::HandleFall(), misc_commandscript::HandleFreezeCommand(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMessagechatOpcode(), AuraEffect::HandleModTaunt(), AuraEffect::HandleModTotalPercentStat(), WorldSession::HandleMovementOpcodes(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), AuraEffect::HandleObsModPowerAuraTick(), WorldSession::HandleOpenItemOpcode(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetAction(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetStopAttack(), misc_commandscript::HandlePInfoCommand(), spell_pal_seal_of_command_aura::HandleProc(), HandleProcTriggerSpell(), WorldSession::HandleReclaimCorpseOpcode(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleSummonResponseOpcode(), WorldSession::HandleUnstablePet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_moroes::InitializeGuests(), Player::IsAtGroupRewardDistance(), Player::IsAtRecruitAFriendDistance(), Creature::IsInvisibleDueToDespawn(), Player::IsOutdoorPvPActive(), Player::IsPetNeedBeTemporaryUnsummoned(), isTargetableForAttack(), IsValidCombatTarget(), Spell::IsValidDeadOrAliveTarget(), ThreatCalcHelper::isValidProcess(), npc_kilrek::JustDied(), boss_rajaxx::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_freya::boss_freyaAI::JustEngagedWith(), npc_underbat::JustEngagedWith(), boss_sartharion::boss_sartharionAI::JustEngagedWith(), boss_fathomlord_karathress::JustReachedHome(), boss_rotface::boss_rotfaceAI::JustSummoned(), Kill(), boss_hadronox::boss_hadronoxAI::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), Player::LoadCorpse(), Player::LoadFromDB(), LoadHelper(), MagicSpellHitResult(), AchievementCriteriaData::Meets(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), boss_lord_marrowgar::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_uldaman::instance_uldaman_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), spell_yogg_saron_brain_link_aura::OnPeriodic(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), at_orb_of_command::OnTrigger(), at_ancient_leaf::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), SmartTrigger::OnTrigger(), AreaTrigger_at_area_52_entrance::OnTrigger(), at_dragonspire_hall::OnTrigger(), at_blackrock_stadium::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_commander_dawnforge::OnTrigger(), RisenArchmageCheck::operator()(), WretchedGhoulCleaner::operator()(), ValithriaDespawner::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck::operator()(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), Acore::NearestPlayerInObjectRangeCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::AnyUnitInObjectRangeCheck::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Acore::AnyDeadUnitCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::MostHPMissingGroupInRange::operator()(), FrostwingVrykulSearcher::operator()(), Acore::AllDeadCreaturesInRange::operator()(), ShadowTrapLKTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), MapMgr::PlayerCannotEnter(), ProcDamageAndSpell(), SmartScript::ProcessAction(), RemoveCharmedBy(), Group::RemoveMember(), Player::RemovePet(), Battleground::RemovePlayerAtLeave(), Player::RepopAtGraveyard(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_fathomlord_karathress::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), Creature::Respawn(), Player::RewardPlayerAndGroupAtEvent(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), Player::SendLoot(), npc_corrupted_totem::SetAura(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), SetConfused(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::SetData(), npc_enslaved_proto_drake::SetData(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::SetData(), boss_teron_gorefiend::SetData(), Player::setDeathState(), Creature::SetDisableGravity(), SetFeared(), Creature::SetHover(), SetInCombatState(), SetStunned(), Battlefield::ShowNpc(), npc_dark_iron_guzzler::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), boss_janalai::StartBombing(), WaypointMovementGenerator< Creature >::StartMove(), PassengerController::SummonCreatures(), boss_rend_blackhand::boss_rend_blackhandAI::SummonedCreatureDespawn(), boss_priestess_delrissa::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), Player::SwapItem(), lfg::LFGMgr::TeleportPlayer(), BattlegroundRV::TeleportUnitToNewZ(), Pet::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Puppet::Update(), Player::Update(), Totem::Update(), Update(), TimedFleeingMovementGenerator::Update(), TotemAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), PetAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), Creature::UpdateMovementFlags(), boss_netherspite::UpdatePortals(), boss_twin_valkyrAI::UpdateSharedHealth(), UpdateSplineMovement(), Player::UpdateZone(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsAlwaysDetectableFor()

bool Unit::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

14238{
14240 return true;
14241
14242 if (HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, seer->GetGUID()))
14243 return true;
14244
14245 if (Player* ownerPlayer = GetSpellModOwner())
14246 if (Player const* seerPlayer = seer->ToPlayer())
14247 {
14248 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
14249 return true;
14250 }
14251
14252 return false;
14253}
@ SPELL_AURA_MOD_STALKED
Definition SpellAuraDefines.h:131
virtual bool IsAlwaysDetectableFor(WorldObject const *) const
Definition Object.h:666

References Object::GetGUID(), GetSpellModOwner(), HasAuraTypeWithCaster(), WorldObject::IsAlwaysDetectableFor(), SPELL_AURA_MOD_STALKED, and Object::ToPlayer().

Referenced by Creature::IsAlwaysDetectableFor(), and Player::IsAlwaysDetectableFor().

◆ IsAlwaysVisibleFor()

bool Unit::IsAlwaysVisibleFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

14219{
14221 return true;
14222
14223 // Always seen by owner
14224 if (ObjectGuid guid = GetCharmerOrOwnerGUID())
14225 if (seer->GetGUID() == guid)
14226 return true;
14227
14228 if (Player const* seerPlayer = seer->ToPlayer())
14229 if (Unit* owner = GetOwner())
14230 if (Player* ownerPlayer = owner->ToPlayer())
14231 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
14232 return true;
14233
14234 return false;
14235}
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition Object.h:663

References GetCharmerOrOwnerGUID(), Object::GetGUID(), GetOwner(), WorldObject::IsAlwaysVisibleFor(), and Object::ToPlayer().

◆ IsArmorer()

bool Unit::IsArmorer ( ) const
inline
@ UNIT_NPC_FLAG_REPAIR
Definition UnitDefines.h:327
bool HasNpcFlag(NPCFlags flags) const
Definition Unit.h:731

References HasNpcFlag(), and UNIT_NPC_FLAG_REPAIR.

◆ isAttackingPlayer()

bool Unit::isAttackingPlayer ( ) const
10486{
10488 return true;
10489
10490 if (!m_Controlled.empty())
10491 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10492 if ((*itr)->isAttackingPlayer())
10493 return true;
10494
10495 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
10496 if (m_SummonSlot[i])
10497 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
10498 if (summon->isAttackingPlayer())
10499 return true;
10500
10501 return false;
10502}
Creature * GetCreature(ObjectGuid const guid)
Definition Map.cpp:3317

References Map::GetCreature(), WorldObject::GetMap(), HasUnitState(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, and UNIT_STATE_ATTACK_PLAYER.

◆ isAttackReady()

◆ IsAttackSpeedOverridenShapeShift()

bool Unit::IsAttackSpeedOverridenShapeShift ( ) const
19538{
19539 // Mirroring clientside gameplay logic
19540 if (ShapeshiftForm form = GetShapeshiftForm())
19541 if (SpellShapeshiftFormEntry const* entry = sSpellShapeshiftFormStore.LookupEntry(form))
19542 return entry->attackSpeed > 0;
19543
19544 return false;
19545}

References GetShapeshiftForm(), and sSpellShapeshiftFormStore.

Referenced by Player::CalculateMinMaxDamage().

◆ IsAuctioner()

bool Unit::IsAuctioner ( ) const
inline
@ UNIT_NPC_FLAG_AUCTIONEER
Definition UnitDefines.h:336

References HasNpcFlag(), and UNIT_NPC_FLAG_AUCTIONEER.

◆ IsBanker()

bool Unit::IsBanker ( ) const
inline
@ UNIT_NPC_FLAG_BANKER
Definition UnitDefines.h:332

References HasNpcFlag(), and UNIT_NPC_FLAG_BANKER.

◆ IsBattleMaster()

bool Unit::IsBattleMaster ( ) const
inline

◆ isBeingLoaded()

virtual bool Unit::isBeingLoaded ( ) const
inlinevirtual

Reimplemented in Pet, and Player.

673{ return false;}

Referenced by Player::SetMover().

◆ isBlockCritical()

bool Unit::isBlockCritical ( )
3127{
3129 return true;
3130 return false;
3131}
@ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
Definition SpellAuraDefines.h:316

References GetTotalAuraModifier(), roll_chance_i(), and SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.

Referenced by CalculateMeleeDamage(), and CalculateSpellDamageTaken().

◆ IsCharmed()

◆ IsCharmedOwnedByPlayerOrPlayer()

bool Unit::IsCharmedOwnedByPlayerOrPlayer ( ) const
inline
ObjectGuid GetCharmerOrOwnerOrOwnGUID() const
Definition Unit.h:1227

References GetCharmerOrOwnerOrOwnGUID(), and ObjectGuid::IsPlayer().

Referenced by Spell::DoSpellHitOnUnit(), and ProcDamageAndSpellFor().

◆ IsClass()

◆ IsContestedGuard()

bool Unit::IsContestedGuard ( ) const
inline
980 {
982 return entry->IsContestedGuardFaction();
983
984 return false;
985 }

References GetFactionTemplateEntry().

Referenced by Acore::NearestVisibleDetectableContestedGuardUnitCheck::operator()().

◆ IsControllableGuardian()

bool Unit::IsControllableGuardian ( ) const
inline

◆ IsControlledByPlayer()

◆ IsCreatedByPlayer()

bool Unit::IsCreatedByPlayer ( ) const
inline
1239{ return m_CreatedByPlayer; }

References m_CreatedByPlayer.

Referenced by DealDamage().

◆ IsCritter()

◆ IsDamageReducedByArmor()

bool Unit::IsDamageReducedByArmor ( SpellSchoolMask  damageSchoolMask,
SpellInfo const *  spellInfo = nullptr,
uint8  effIndex = MAX_SPELL_EFFECTS 
)
static
2009{
2010 // only physical spells damage gets reduced by armor
2011 if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
2012 return false;
2013 if (spellInfo)
2014 {
2015 // there are spells with no specific attribute but they have "ignores armor" in tooltip
2016 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR))
2017 return false;
2018
2019 // bleeding effects are not reduced by armor
2020 if (effIndex != MAX_SPELL_EFFECTS)
2021 {
2022 if (spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
2023 spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
2024 if (spellInfo->GetEffectMechanicMask(effIndex) & (1 << MECHANIC_BLEED))
2025 return false;
2026 }
2027 }
2028 return true;
2029}
@ MECHANIC_BLEED
Definition SharedDefines.h:1340
@ SPELL_ATTR0_CU_IGNORE_ARMOR
Definition SpellInfo.h:191

References SpellInfo::Effects, SpellInfo::GetEffectMechanicMask(), SpellInfo::HasAttribute(), MAX_SPELL_EFFECTS, MECHANIC_BLEED, SPELL_ATTR0_CU_IGNORE_ARMOR, SPELL_AURA_PERIODIC_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ isDead()

bool Unit::isDead ( ) const
inline

References Corpse, Dead, and m_deathState.

Referenced by npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraDummy(), Player::HandleFall(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), misc_commandscript::HandleRespawnCommand(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), Creature::HasSpellFocus(), UnitAI::InitializeAI(), SmartAI::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_spinestalker::npc_spinestalkerAI::InitializeAI(), npc_rimefang::npc_rimefangAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), Player::isAllowedToLoot(), npc_anubisath_sentinel::aqsentinelAI::JustDied(), Player::OnGossipSelect(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), Player::PrepareGossipMenu(), SmartScript::ProcessAction(), Player::RepopAtGraveyard(), npc_anubisath_sentinel::aqsentinelAI::Reset(), WorldSession::SendAttackStop(), SendMeleeAttackStop(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), and npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI().

◆ IsDuringRemoveFromWorld()

◆ isDying()

bool Unit::isDying ( ) const
inline
1705{ return (m_deathState == DeathState::JustDied); };

References JustDied, and m_deathState.

Referenced by Creature::IsInvisibleDueToDespawn(), and SetHover().

◆ IsEngaged()

◆ IsEngagedBy()

bool Unit::IsEngagedBy ( Unit const *  who) const
inline

◆ IsFalling()

◆ IsFFAPvP()

bool Unit::IsFFAPvP ( ) const
inline

◆ IsFlying()

◆ IsFriendlyTo()

bool Unit::IsFriendlyTo ( Unit const *  unit) const
10265{
10266 return GetReactionTo(unit) >= REP_FRIENDLY;
10267}

References GetReactionTo(), and REP_FRIENDLY.

Referenced by Spell::_cast(), AuraApplication::_InitFlags(), Creature::_IsTargetAcceptable(), FollowerAI::AssistPlayerInCombatAgainst(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), Creature::CanAssistTo(), spell_dk_death_coil::CheckCast(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), Spell::CheckCast(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectStealBeneficialBuff(), Spell::EffectThreat(), Aura::HandleAuraSpecificMods(), spell_dk_death_coil::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pri_penance::HandleDummy(), HandleDummyAuraProc(), BattlefieldWG::HandleKill(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), WorldSession::HandleSetSelectionOpcode(), Spell::HandleThreatSpells(), GameObject::IsAlwaysVisibleFor(), SpellClickInfo::IsFitToRequirements(), npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), PetSpellFail(), SmartScript::ProcessEvent(), RemoveCharmedBy(), Spell::SelectExplicitTargets(), Player::SendLoot(), Acore::MessageDistDelivererToHostile::SendPacket(), and TotemAI::UpdateAI().

◆ isFrozen()

◆ IsFullHealth()

◆ IsGossip()

bool Unit::IsGossip ( ) const
inline
@ UNIT_NPC_FLAG_GOSSIP
Definition UnitDefines.h:315

References HasNpcFlag(), and UNIT_NPC_FLAG_GOSSIP.

◆ IsGuardian()

◆ IsGuildMaster()

bool Unit::IsGuildMaster ( ) const
inline
@ UNIT_NPC_FLAG_PETITIONER
Definition UnitDefines.h:333

References HasNpcFlag(), and UNIT_NPC_FLAG_PETITIONER.

◆ IsHostileTo()

◆ IsHostileToPlayers()

bool Unit::IsHostileToPlayers ( ) const
10270{
10271 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
10272 if (!my_faction || !my_faction->faction)
10273 return false;
10274
10275 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
10276 if (raw_faction && raw_faction->reputationListID >= 0)
10277 return false;
10278
10279 return my_faction->IsHostileToPlayers();
10280}
int32 reputationListID
Definition DBCStructure.h:908
uint32 faction
Definition DBCStructure.h:940
bool IsHostileToPlayers() const
Definition DBCStructure.h:980

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsHostileToPlayers(), FactionEntry::reputationListID, and sFactionStore.

◆ IsHovering()

◆ IsHunterPet()

◆ IsImmunedToDamage() [1/3]

bool Unit::IsImmunedToDamage ( Spell const *  spell) const
12819{
12820 SpellInfo const* spellInfo = spell->GetSpellInfo();
12821 if (!spellInfo)
12822 {
12823 return false;
12824 }
12825
12827 {
12828 return false;
12829 }
12830
12832 {
12833 return false;
12834 }
12835
12836 uint32 schoolMask = spell->GetSpellSchoolMask();
12837 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12838 {
12839 return false;
12840 }
12841
12842 // If m_immuneToDamage type contain magic, IMMUNE damage.
12843 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12844 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12845 {
12846 if ((itr->type & schoolMask) == schoolMask)
12847 {
12848 return true;
12849 }
12850 }
12851
12852 return false;
12853}
@ SPELL_ATTR2_NO_SCHOOL_IMMUNITIES
Definition SharedDefines.h:482
@ SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS
Definition SharedDefines.h:435
@ IMMUNITY_DAMAGE
Definition SharedDefines.h:1397
@ SPELL_SCHOOL_MASK_NONE
Definition SharedDefines.h:296
std::vector< SpellImmune > SpellImmuneList
Definition SpellDefines.h:182

References Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [2/3]

bool Unit::IsImmunedToDamage ( SpellInfo const *  spellInfo) const
12787{
12788 if (!spellInfo)
12789 {
12790 return false;
12791 }
12792
12793 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
12794 {
12795 return false;
12796 }
12797
12798 if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
12799 {
12800 return false;
12801 }
12802
12803 uint32 schoolMask = spellInfo->GetSchoolMask();
12804 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12805 {
12806 return false;
12807 }
12808
12809 // If m_immuneToDamage type contain magic, IMMUNE damage.
12810 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12811 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12812 if ((itr->type & schoolMask) == schoolMask)
12813 return true;
12814
12815 return false;
12816}

References SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [3/3]

bool Unit::IsImmunedToDamage ( SpellSchoolMask  meleeSchoolMask) const
12771{
12772 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
12773 {
12774 return false;
12775 }
12776
12777 // If m_immuneToDamage type contain magic, IMMUNE damage.
12778 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12779 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12780 if ((itr->type & meleeSchoolMask) == meleeSchoolMask)
12781 return true;
12782
12783 return false;
12784}

References IMMUNITY_DAMAGE, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by boss_gurtogg_bloodboil::CanAIAttack(), Spell::DoSpellHitOnUnit(), IsImmunedToDamageOrSchool(), and IsImmunedToDamageOrSchool().

◆ IsImmunedToDamageOrSchool() [1/2]

bool Unit::IsImmunedToDamageOrSchool ( SpellInfo const *  spellInfo) const
12935{
12936 return IsImmunedToDamage(spellInfo) || IsImmunedToSchool(spellInfo);
12937}
bool IsImmunedToSchool(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:12855
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition Unit.cpp:12770

References IsImmunedToDamage(), and IsImmunedToSchool().

◆ IsImmunedToDamageOrSchool() [2/2]

◆ IsImmunedToSchool() [1/3]

bool Unit::IsImmunedToSchool ( Spell const *  spell) const
12895{
12896 SpellInfo const* spellInfo = spell->GetSpellInfo();
12898 {
12899 return false;
12900 }
12901
12902 uint32 schoolMask = spell->GetSpellSchoolMask();
12903 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12904 {
12905 return false;
12906 }
12907
12908 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12909 {
12910 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12911 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12912 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12913 {
12914 if ((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
12915 {
12916 return true;
12917 }
12918 }
12919 }
12920
12921 return false;
12922}
@ IMMUNITY_SCHOOL
Definition SharedDefines.h:1396
bool CanPierceImmuneAura(SpellInfo const *aura) const
Definition SpellInfo.cpp:1323

References SpellInfo::CanPierceImmuneAura(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [2/3]

bool Unit::IsImmunedToSchool ( SpellInfo const *  spellInfo) const
12872{
12873 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
12874 return false;
12875
12876 uint32 schoolMask = spellInfo->GetSchoolMask();
12877 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12878 {
12879 return false;
12880 }
12881
12882 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12883 {
12884 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12885 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12886 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12887 if ((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
12888 return true;
12889 }
12890
12891 return false;
12892}

References SpellInfo::CanPierceImmuneAura(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [3/3]

bool Unit::IsImmunedToSchool ( SpellSchoolMask  meleeSchoolMask) const
12856{
12857 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
12858 {
12859 return false;
12860 }
12861
12862 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12863 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12864 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12865 if ((itr->type & meleeSchoolMask) == meleeSchoolMask)
12866 return true;
12867
12868 return false;
12869}

References IMMUNITY_SCHOOL, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by Spell::DoSpellHitOnUnit(), IsImmunedToDamageOrSchool(), IsImmunedToDamageOrSchool(), SpellHitResult(), and SpellHitResult().

◆ IsImmunedToSpell()

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Spell const *  spell = nullptr 
)
virtual

Reimplemented in Creature.

12940{
12941 if (!spellInfo)
12942 return false;
12943
12944 // Single spell immunity.
12945 SpellImmuneList const& idList = m_spellImmune[IMMUNITY_ID];
12946 for (SpellImmuneList::const_iterator itr = idList.begin(); itr != idList.end(); ++itr)
12947 if (itr->type == spellInfo->Id)
12948 return true;
12949
12950 // xinef: my special immunity, if spellid is not on this list it means npc is immune
12951 SpellImmuneList const& allowIdList = m_spellImmune[IMMUNITY_ALLOW_ID];
12952 if (!allowIdList.empty())
12953 {
12954 for (SpellImmuneList::const_iterator itr = allowIdList.begin(); itr != allowIdList.end(); ++itr)
12955 if (itr->type == spellInfo->Id)
12956 return false;
12957 return true;
12958 }
12959
12960 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
12961 return false;
12962
12963 if (spellInfo->Dispel)
12964 {
12965 SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
12966 for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
12967 if (itr->type == spellInfo->Dispel)
12968 return true;
12969 }
12970
12971 // Spells that don't have effectMechanics.
12972 if (spellInfo->Mechanic)
12973 {
12974 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
12975 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
12976 if (itr->type == spellInfo->Mechanic)
12977 return true;
12978 }
12979
12980 bool immuneToAllEffects = true;
12981 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12982 {
12983 // State/effect immunities applied by aura expect full spell immunity
12984 // Ignore effects with mechanic, they are supposed to be checked separately
12985 if (!spellInfo->Effects[i].IsEffect())
12986 continue;
12987
12988 // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
12989 if (IsImmunedToSpellEffect(spellInfo, i))
12990 {
12991 if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
12992 return true;
12993 continue;
12994 }
12995
12996 immuneToAllEffects = false;
12997 break;
12998 }
12999 if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
13000 return true;
13001
13002 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
13003 {
13004 SpellSchoolMask spellSchoolMask = spellInfo->GetSchoolMask();
13005 if (spell)
13006 {
13007 spellSchoolMask = spell->GetSpellSchoolMask();
13008 }
13009
13010 if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE)
13011 {
13012 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
13013 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
13014 {
13015 SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->spellId);
13016 if (((itr->type & spellSchoolMask) == spellSchoolMask)
13017 && (!immuneSpellInfo || immuneSpellInfo->IsPositive()) && !spellInfo->IsPositive()
13018 && !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
13019 {
13020 return true;
13021 }
13022 }
13023 }
13024 }
13025
13026 return false;
13027}
@ IMMUNITY_ALLOW_ID
Definition SharedDefines.h:1401
@ IMMUNITY_ID
Definition SharedDefines.h:1400
@ IMMUNITY_MECHANIC
Definition SharedDefines.h:1399

References SpellInfo::CanPierceImmuneAura(), SpellInfo::Dispel, SpellInfo::Effects, SpellInfo::GetSchoolMask(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasSpiritOfRedemptionAura(), SpellInfo::Id, IMMUNITY_ALLOW_ID, IMMUNITY_DISPEL, IMMUNITY_ID, IMMUNITY_MECHANIC, IMMUNITY_SCHOOL, IsImmunedToSpellEffect(), SpellInfo::IsPositive(), m_spellImmune, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_TRANSFORM, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

Referenced by AddAura(), Spell::DoSpellHitOnUnit(), Creature::IsImmunedToSpell(), spell_hun_lock_and_load::IsTargetValid(), boss_talon_king_ikiss::JustEngagedWith(), boss_kiggler_the_crazed::JustEngagedWith(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), SpellHitResult(), and SpellHitResult().

◆ IsImmunedToSpellEffect()

bool Unit::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index 
) const
virtual

Reimplemented in Creature, and Totem.

13030{
13031 if (!spellInfo || !spellInfo->Effects[index].IsEffect())
13032 return false;
13033
13034 // xinef: pet scaling auras
13035 if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
13036 return false;
13037
13038 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) && !HasSpiritOfRedemptionAura())
13039 return false;
13040
13041 //If m_immuneToEffect type contain this effect type, IMMUNE effect.
13042 uint32 effect = spellInfo->Effects[index].Effect;
13043 SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
13044 for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
13045 {
13046 if (itr->type == effect && (itr->spellId != 62692 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
13047 {
13048 return true;
13049 }
13050 }
13051
13052 if (uint32 mechanic = spellInfo->Effects[index].Mechanic)
13053 {
13054 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
13055 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
13056 if (itr->type == mechanic)
13057 return true;
13058 }
13059
13060 if (uint32 aura = spellInfo->Effects[index].ApplyAuraName)
13061 {
13063 for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
13064 {
13065 if (itr->type == aura && (itr->spellId != 64848 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
13066 {
13067 if (!spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
13068 {
13069 if (itr->blockType == SPELL_BLOCK_TYPE_ALL || spellInfo->IsPositive()) // xinef: added for pet scaling
13070 {
13071 return true;
13072 }
13073 }
13074 }
13075 }
13076
13077 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
13078 {
13079 // Check for immune to application of harmful magical effects
13081 for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
13082 {
13083 if (/*(spellInfo->Dispel == DISPEL_MAGIC || spellInfo->Dispel == DISPEL_CURSE || spellInfo->Dispel == DISPEL_DISEASE) &&*/ // Magic debuff, xinef: all kinds?
13084 ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
13085 !spellInfo->IsPositiveEffect(index) && // Harmful
13086 spellInfo->Effects[index].Effect != SPELL_EFFECT_PERSISTENT_AREA_AURA) // Not Persistent area auras
13087 {
13088 return true;
13089 }
13090 }
13091 }
13092 }
13093
13094 return false;
13095}
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition SharedDefines.h:805
@ SPELL_ATTR3_ALWAYS_HIT
Definition SharedDefines.h:511
@ IMMUNITY_STATE
Definition SharedDefines.h:1395
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1394
@ SPELL_ATTR4_OWNER_POWER_SCALING
Definition SharedDefines.h:555
@ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL
Definition SpellAuraDefines.h:330
@ SPELL_BLOCK_TYPE_ALL
Definition SpellDefines.h:159
bool CanRestoreMana(SpellInfo const *spellInfo) const
Definition Unit.cpp:21255

References CanRestoreMana(), SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasSpiritOfRedemptionAura(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, SpellInfo::IsPositive(), SpellInfo::IsPositiveEffect(), m_spellImmune, POWER_MANA, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_OWNER_POWER_SCALING, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, SPELL_BLOCK_TYPE_ALL, and SPELL_EFFECT_PERSISTENT_AREA_AURA.

Referenced by AddAura(), Spell::AddUnitTarget(), Spell::DoSpellHitOnUnit(), spell_dk_death_grip::HandleBaseDummy(), IsImmunedToSpell(), and Creature::IsImmunedToSpellEffect().

◆ IsImmuneToAll()

bool Unit::IsImmuneToAll ( ) const
inline
881{ return IsImmuneToPC() && IsImmuneToNPC(); }

References IsImmuneToNPC(), and IsImmuneToPC().

◆ IsImmuneToNPC()

◆ IsImmuneToPC()

◆ isInAccessiblePlaceFor()

bool Unit::isInAccessiblePlaceFor ( Creature const *  c) const
4194{
4195 if (c->GetMapId() == 618) // Ring of Valor
4196 {
4197 // skip transport check, check for being below floor level
4198 if (this->GetPositionZ() < 28.0f)
4199 return false;
4200 if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap())
4201 if (Battleground* bg = bgMap->GetBG())
4202 if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time
4203 return false;
4204 }
4205 else if (c->GetMapId() == 631) // Icecrown Citadel
4206 {
4207 // if static transport doesn't match - return false
4208 if (c->GetTransport() != this->GetTransport() && ((c->GetTransport() && c->GetTransport()->IsStaticTransport()) || (this->GetTransport() && this->GetTransport()->IsStaticTransport())))
4209 return false;
4210
4211 // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack
4212 if (c->GetOwnerGUID().IsPlayer() && !c->CanFly())
4213 {
4214 if (c->GetTransport() != this->GetTransport())
4215 return false;
4216 if (this->GetTransport())
4217 {
4218 if (c->GetPositionY() < 2033.0f)
4219 {
4220 if (this->GetPositionY() > 2033.0f)
4221 return false;
4222 }
4223 else if (c->GetPositionY() < 2438.0f)
4224 {
4225 if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f)
4226 return false;
4227 }
4228 else if (this->GetPositionY() < 2438.0f)
4229 return false;
4230 }
4231 }
4232 }
4233 else
4234 {
4235 // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away
4236 if (c->GetTransport() != this->GetTransport())
4237 return false;
4238 }
4239
4240 LiquidStatus liquidStatus = GetLiquidData().Status;
4241 bool isInWater = (liquidStatus & MAP_LIQUID_STATUS_IN_CONTACT) != 0;
4242
4243 // In water or jumping in water
4244 if (isInWater || (liquidStatus == LIQUID_MAP_ABOVE_WATER && (IsFalling() || (ToPlayer() && ToPlayer()->IsFalling()))))
4245 {
4246 return c->CanEnterWater();
4247 }
4248 else
4249 {
4250 return c->CanWalk() || c->CanFly();
4251 }
4252}
LiquidStatus
Definition Map.h:141
@ LIQUID_MAP_ABOVE_WATER
Definition Map.h:143
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition Map.h:150
Definition Map.h:851
BattlegroundMap * ToBattlegroundMap()
Definition Map.h:547
bool IsFalling() const
Definition Unit.cpp:19975
LiquidData const & GetLiquidData() const
Definition Object.cpp:3192
LiquidStatus Status
Definition Map.h:176

References Creature::CanEnterWater(), Creature::CanFly(), Creature::CanWalk(), WorldObject::GetLiquidData(), WorldObject::GetMap(), WorldLocation::GetMapId(), GetOwnerGUID(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), IsFalling(), ObjectGuid::IsPlayer(), GameObject::IsStaticTransport(), LIQUID_MAP_ABOVE_WATER, MAP_LIQUID_STATUS_IN_CONTACT, LiquidData::Status, Map::ToBattlegroundMap(), and Object::ToPlayer().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), ChaseMovementGenerator< T >::DoUpdate(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), and HostileReference::updateOnlineStatus().

◆ isInBackInMap()

bool Unit::isInBackInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const

◆ IsInCombat()

bool Unit::IsInCombat ( ) const
inline

References HasUnitFlag(), and UNIT_FLAG_IN_COMBAT.

Referenced by _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), npc_argent_captainAI::CanAIAttack(), Player::CanEquipItem(), Creature::CanPeriodicallyCallForAssistance(), Player::CanUnequipItem(), boss_high_nethermancer_zerevor::CastDampenMagicIfPossible(), spell_hun_disengage::CheckCast(), Spell::CheckCast(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CombatStart(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), npc_risen_archmage::npc_risen_archmageAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoAllEffectOnTarget(), UnitAI::DoCastToAllHostilePlayers(), Spell::DoSpellHitOnUnit(), Spell::EffectActivateRune(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), Player::EquipItem(), CastRunesEvent::Execute(), GetVelocity(), spell_apothecary_lingering_fumes::HandleAfterCast(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), spell_mc_play_dead_aura::HandleEffectRemove(), WorldSession::HandleEquipmentSetUse(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), spell_putricide_mutated_transformation::HandleSummon(), WorldSession::HandleSummonResponseOpcode(), tele_commandscript::HandleTeleCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleUseItemOpcode(), npc_pet_mage_mirror_image::InitializeAI(), IsEngaged(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), Pet::LoseHappiness(), CreatureGroup::MemberEvaded(), CreatureAI::MoveInLineOfSight(), boss_eye_of_cthun::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_alar::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_death_knight_initiate::OnGossipHello(), npc_ulduar_expedition_commander::OnGossipHello(), go_ulduar_working_harpoon::OnGossipHello(), npc_death_knight_initiate::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), at_frozen_throne_teleport::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), RisenArchmageCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::OwnerAttackedBy(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), SmartScript::ProcessEvent(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), boss_grand_warlock_nethekurse::SetData(), SetInCombatState(), SetSpeed(), boss_prince_keleseth_icc::boss_prince_kelesethAI::SpellHit(), boss_prince_taldaram_icc::boss_prince_taldaramAI::SpellHit(), boss_prince_valanar_icc::boss_prince_valanarAI::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SpellHit(), Spell::SummonGuardian(), lfg::LFGMgr::TeleportPlayer(), Map::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Update(), DistractMovementGenerator::Update(), TotemAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_thekal::UpdateAI(), npc_zealot_lorkhan::UpdateAI(), npc_zealot_zath::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), PassiveAI::UpdateAI(), PetAI::UpdateAI(), Player::UpdateContestedPvP(), Creature::UpdateEntry(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), InstanceScript::UpdateMinionState(), SmartAI::UpdatePath(), Player::UpdatePotionCooldown(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsInCombatWith()

bool Unit::IsInCombatWith ( Unit const *  who) const
21062{
21063 // Check target exists
21064 if (!who)
21065 return false;
21066 // Search in threat list
21067 ObjectGuid guid = who->GetGUID();
21068 for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.GetThreatList().begin(); i != m_ThreatMgr.GetThreatList().end(); ++i)
21069 {
21070 HostileReference* ref = (*i);
21071 // Return true if the unit matches
21072 if (ref && ref->getUnitGuid() == guid)
21073 return true;
21074 }
21075 // Nothing found, false.
21076 return false;
21077}
Definition ThreatMgr.h:48
ObjectGuid getUnitGuid() const
Definition ThreatMgr.h:106
ThreatContainer::StorageType const & GetThreatList() const
Definition ThreatMgr.h:273

References Object::GetGUID(), ThreatMgr::GetThreatList(), HostileReference::getUnitGuid(), and m_ThreatMgr.

Referenced by _IsValidAttackTarget(), DealDamage(), Spell::DoAllEffectOnTarget(), TemporaryThreatModifierEvent::Execute(), spell_herald_volzaj_insanity::HandleDummyEffect(), IsEngagedBy(), and Acore::NearestAttackableUnitInObjectRangeCheck::operator()().

◆ IsInDisallowedMountForm()

bool Unit::IsInDisallowedMountForm ( ) const
21285{
21286 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
21287 {
21288 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
21289 {
21290 return false;
21291 }
21292 }
21293
21294 if (ShapeshiftForm form = GetShapeshiftForm())
21295 {
21296 SpellShapeshiftFormEntry const* shapeshift = sSpellShapeshiftFormStore.LookupEntry(form);
21297 if (!shapeshift)
21298 {
21299 return true;
21300 }
21301
21302 if (!(shapeshift->flags1 & SHAPESHIFT_FLAG_STANCE))
21303 {
21304 return true;
21305 }
21306 }
21307
21309 {
21310 return false;
21311 }
21312
21313 CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId());
21314 if (!display)
21315 {
21316 return true;
21317 }
21318
21320 if (!displayExtra)
21321 {
21322 return true;
21323 }
21324
21325 CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId);
21326 ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->DisplayRaceID);
21327
21328 if (model && !(model->HasFlag(CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT)))
21329 {
21330 if (race && !(race->HasFlag(CHRRACES_FLAGS_CAN_MOUNT)))
21331 {
21332 return true;
21333 }
21334 }
21335
21336 return false;
21337}
@ CHRRACES_FLAGS_CAN_MOUNT
Definition DBCStructure.h:674
@ CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT
Definition DBCStructure.h:770
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition SharedDefines.h:406
@ SHAPESHIFT_FLAG_STANCE
Definition UnitDefines.h:104
uint32 getTransForm() const
Definition Unit.h:1881
bool HasFlag(ChrRacesFlags flag) const
Definition DBCStructure.h:699
uint32 ExtendedDisplayInfoID
Definition DBCStructure.h:724
uint32 DisplayRaceID
Definition DBCStructure.h:740
bool HasFlag(CreatureModelDataFlags flag) const
Definition DBCStructure.h:803
uint32 flags1
Definition DBCStructure.h:1821

References CHRRACES_FLAGS_CAN_MOUNT, CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT, CreatureDisplayInfoExtraEntry::DisplayRaceID, CreatureDisplayInfoEntry::ExtendedDisplayInfoID, SpellShapeshiftFormEntry::flags1, GetDisplayId(), GetNativeDisplayId(), GetShapeshiftForm(), getTransForm(), ChrRacesEntry::HasFlag(), CreatureModelDataEntry::HasFlag(), CreatureDisplayInfoEntry::ModelId, sChrRacesStore, sCreatureDisplayInfoExtraStore, sCreatureDisplayInfoStore, sCreatureModelDataStore, SHAPESHIFT_FLAG_STANCE, SPELL_ATTR0_ALLOW_WHILE_MOUNTED, sSpellMgr, and sSpellShapeshiftFormStore.

Referenced by Player::ActivateTaxiPathTo(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), Spell::CheckCast(), Player::ContinueTaxiFlight(), and Player::ProcessDelayedOperations().

◆ IsInFeralForm()

bool Unit::IsInFeralForm ( ) const
inline

◆ IsInFlight()

bool Unit::IsInFlight ( ) const
inline

◆ isInFrontInMap()

bool Unit::isInFrontInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const
4184{
4185 return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
4186}

References Position::HasInArc(), and WorldObject::IsWithinDistInMap().

◆ IsInnkeeper()

bool Unit::IsInnkeeper ( ) const
inline
@ UNIT_NPC_FLAG_INNKEEPER
Definition UnitDefines.h:331

References HasNpcFlag(), and UNIT_NPC_FLAG_INNKEEPER.

Referenced by npc_innkeeper::OnGossipHello().

◆ IsInPartyWith()

bool Unit::IsInPartyWith ( Unit const *  unit) const
18798{
18799 if (this == unit)
18800 return true;
18801
18802 Unit const* u1 = GetCharmerOrOwnerOrSelf();
18803 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
18804 if (u1 == u2)
18805 return true;
18806
18807 if (u1->IsPlayer() && u2->IsPlayer())
18808 return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
18809 // Xinef: we assume that npcs with the same faction are in party
18810 else if (u1->IsCreature() && u2->IsCreature() && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
18811 return u1->GetFaction() == u2->GetFaction();
18812 // Xinef: creature type_flag should work for party check only if player group is not a raid
18815 return true;
18816 else
18817 return false;
18818}
bool isRaidGroup() const
Definition Group.cpp:2267
bool IsInSameGroupWith(Player const *p) const
Definition Player.cpp:2332

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Player::GetGroup(), IsControlledByPlayer(), Object::IsCreature(), Player::IsInSameGroupWith(), Object::IsPlayer(), Group::isRaidGroup(), Object::ToCreature(), Object::ToPlayer(), and CreatureTemplate::type_flags.

Referenced by SpellInfo::CheckExplicitTarget(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ IsInRaidWith()

bool Unit::IsInRaidWith ( Unit const *  unit) const
18821{
18822 if (this == unit)
18823 return true;
18824
18825 Unit const* u1 = GetCharmerOrOwnerOrSelf();
18826 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
18827 if (u1 == u2)
18828 return true;
18829
18830 if (u1->IsPlayer() && u2->IsPlayer())
18831 return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
18832 // Xinef: we assume that npcs with the same faction are in party
18833 else if (u1->IsCreature() && u2->IsCreature() && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
18834 return u1->GetFaction() == u2->GetFaction();
18837 return true;
18838 else
18839 return false;
18840}

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), IsControlledByPlayer(), Object::IsCreature(), Player::IsInSameRaidWith(), Object::IsPlayer(), Object::ToCreature(), Object::ToPlayer(), and CreatureTemplate::type_flags.

Referenced by Corpse::BuildValuesUpdate(), SpellInfo::CheckExplicitTarget(), spell_dru_t10_restoration_4p_bonus::FilterTargets(), GetReactionTo(), WorldSession::HandleLootMasterGiveOpcode(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), and PatchValuesUpdate().

◆ IsInSanctuary()

bool Unit::IsInSanctuary ( ) const
inline

◆ IsInWater()

bool Unit::IsInWater ( ) const
virtual

◆ IsLevitating()

◆ IsMounted()

◆ IsMovementPreventedByCasting()

bool Unit::IsMovementPreventedByCasting ( ) const
virtual

Reimplemented in Creature.

4160{
4161 // can always move when not casting
4163 {
4164 return false;
4165 }
4166
4167 // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
4169 {
4170 if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
4171 {
4172 if (spell->GetSpellInfo()->IsActionAllowedChannel())
4173 {
4174 return false;
4175 }
4176 }
4177 }
4178
4179 // prohibit movement for all other spell casts
4180 return true;
4181}
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185

References CURRENT_CHANNELED_SPELL, HasUnitState(), m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by TimedFleeingMovementGenerator::Update().

◆ isMoving()

◆ IsNeutralToAll()

bool Unit::IsNeutralToAll ( ) const
10283{
10284 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
10285 if (!my_faction || !my_faction->faction)
10286 return true;
10287
10288 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
10289 if (raw_faction && raw_faction->reputationListID >= 0)
10290 return false;
10291
10292 return my_faction->IsNeutralToAll();
10293}
bool IsNeutralToAll() const
Definition DBCStructure.h:981

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsNeutralToAll(), FactionEntry::reputationListID, and sFactionStore.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), AggressorAI::Permissible(), and ReactorAI::Permissible().

◆ IsNonMeleeSpellCast()

bool Unit::IsNonMeleeSpellCast ( bool  withDelayed,
bool  skipChanneled = false,
bool  skipAutorepeat = false,
bool  isAutoshoot = false,
bool  skipInstant = true 
) const
4100{
4101 // We don't do loop here to explicitly show that melee spell is excluded.
4102 // Maybe later some special spells will be excluded too.
4103
4104 // generic spells are cast when they are not finished and not delayed
4107 (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED))
4108 {
4109 if (!skipInstant || m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
4110 {
4111 if (!isAutoshoot || !m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4112 return true;
4113 }
4114 }
4115 // channeled spells may be delayed, but they are still considered cast
4116 if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
4118 {
4119 if (!isAutoshoot || !m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4120 return true;
4121 }
4122 // autorepeat spells may be finished or delayed, but they are still considered cast
4123 if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
4124 return true;
4125
4126 return false;
4127}
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition SharedDefines.h:473

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, m_currentSpells, SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_DELAYED, and SPELL_STATE_FINISHED.

Referenced by Spell::_cast(), _UpdateAutoRepeatSpell(), Player::ActivateSpec(), Player::ActivateTaxiPathTo(), Player::CanEquipItem(), Player::CanExecutePendingSpellCastRequest(), CombatStop(), npc_mograine::npc_mograineAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), ScriptedAI::DoCastSpell(), Spell::EffectKnockBack(), Spell::finish(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), isSpellBlocked(), boss_shade_of_aran::JustEngagedWith(), boss_pandemonius::JustEngagedWith(), MeleeSpellHitResult(), Spell::prepare(), SmartScript::ProcessEvent(), RollMeleeOutcomeAgainst(), setDeathState(), StopAttackFaction(), boss_netherspite::SwitchToPortalPhase(), Player::TeleportTo(), TotemAI::UpdateAI(), npc_chesspiece::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_warmage_violetstand::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ IsOnVehicle()

◆ IsPet()

bool Unit::IsPet ( ) const
inline
760{ return m_unitTypeMask & UNIT_MASK_PET; }
@ UNIT_MASK_PET
Definition UnitDefines.h:160

References m_unitTypeMask, and UNIT_MASK_PET.

Referenced by Spell::_cast(), Spell::AddUnitTarget(), spell_warl_demonic_pact_aura::AfterCheckProc(), Creature::AllLootRemovedFromCorpse(), BeforeVisibilityDestroy< Creature >(), Creature::CallAssistance(), Creature::CallForHelp(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanSeeAlways(), Creature::CanSwim(), ClearInCombat(), CombatStart(), Creature::CreateFromProto(), Player::CreatePet(), DealDamage(), MotionTransport::DelayedTeleportTransport(), PetAI::DoAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectDismissPet(), Spell::EffectForceDeselect(), Spell::EffectRenamePet(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectTameCreature(), Acore::XP::Gain(), Creature::GetAggroRange(), GetCastingTimeForBonus(), GetCombatRatingReduction(), GetCreatePowers(), GetNextRandomRaidMemberOrPet(), GetRandomContactPoint(), GetVelocity(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModStat(), debug_commandscript::HandleDebugThreatListCommand(), AuraEffect::HandleFeignDeath(), modify_commandscript::HandleModifyTalentCommand(), AuraEffect::HandleModPossessPet(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcTameCommand(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), pet_commandscript::HandlePetCreateCommand(), WorldSession::HandlePetRename(), WorldSession::HandlePetSetAction(), misc_commandscript::HandleRespawnCommand(), Creature::InitEntry(), TempSummon::InitStats(), Guardian::InitStatsForLevel(), DisableMgr::IsDisabledFor(), Creature::isElite(), Minion::IsGuardianPet(), Player::isHonorOrXPTarget(), Creature::isWorldBoss(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_underbat::JustEngagedWith(), npc_hivezara_stinger::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_murmur::JustEngagedWith(), Kill(), spell_hun_target_self_and_pet::Load(), ModSpellCastTime(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::MoveInLineOfSight(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::MoveInLineOfSight(), Acore::MostHPMissingGroupInRange::operator()(), PetAI::ReceiveEmote(), RollMeleeOutcomeAgainst(), FactorySelector::SelectAI(), Creature::SelectLevel(), WorldSession::SendPetNameQuery(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetCharm(), Creature::SetDisplayId(), SetHealth(), SetInCombatState(), SetMinion(), Creature::SetObjectScale(), setPowerType(), SpellDamageBonusDone(), SpellPctDamageModsDone(), ToPet(), TempSummon::UnSummon(), Update(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_hazzarah::UpdateAI(), PetAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdateAuraForGroup(), Creature::UpdateEntry(), Creature::UpdateMoveInLineOfSightState(), and UpdateSpeed().

◆ IsPetAura()

bool Unit::IsPetAura ( Aura const *  aura)
17360{
17361 Unit* owner = GetOwner();
17362
17363 if (!owner || !owner->IsPlayer())
17364 return false;
17365
17366 // if the owner has that pet aura, return true
17367 for (PetAura const* petAura : owner->m_petAuras)
17368 if (petAura->GetAura(GetEntry()) == aura->GetId())
17369 return true;
17370
17371 return false;
17372}
Definition SpellMgr.h:470
uint32 GetId(std::string const &username)
Definition AccountMgr.cpp:229

References Object::GetEntry(), Aura::GetId(), GetOwner(), Object::IsPlayer(), and m_petAuras.

Referenced by Pet::_SaveAuras(), and Spell::EffectSummonPet().

◆ IsPetInCombat()

bool Unit::IsPetInCombat ( ) const
inline

◆ IsPolymorphed()

bool Unit::IsPolymorphed ( ) const
16765{
16766 uint32 transformId = getTransForm();
16767 if (!transformId)
16768 return false;
16769
16770 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(transformId);
16771 if (!spellInfo)
16772 return false;
16773
16774 return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
16775}
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition SpellInfo.h:160
SpellSpecificType GetSpellSpecific() const
Definition SpellInfo.cpp:2137

References SpellInfo::GetSpellSpecific(), getTransForm(), SPELL_SPECIFIC_MAGE_POLYMORPH, and sSpellMgr.

Referenced by Attack(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), and Creature::Update().

◆ isPossessed()

◆ isPossessedByPlayer()

bool Unit::isPossessedByPlayer ( ) const
inline

◆ isPossessing() [1/2]

bool Unit::isPossessing ( ) const
inline
1245 {
1246 if (Unit* u = GetCharm())
1247 return u->isPossessed();
1248 else
1249 return false;
1250 }

References GetCharm().

Referenced by WorldSession::HandleCastSpellOpcode(), and misc_commandscript::HandleUnbindSightCommand().

◆ isPossessing() [2/2]

bool Unit::isPossessing ( Unit u) const
inline
1251{ return u->isPossessed() && GetCharmGUID() == u->GetGUID(); }
bool isPossessed() const
Definition Unit.h:1242

References GetCharmGUID(), Object::GetGUID(), and isPossessed().

◆ IsPvP()

◆ IsQuestGiver()

bool Unit::IsQuestGiver ( ) const
inline
@ UNIT_NPC_FLAG_QUESTGIVER
Definition UnitDefines.h:316

References HasNpcFlag(), and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_lokhtos_darkbargainer::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_cos_chromie_middle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_fos_leader::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_queue::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_taxi::OnGossipHello(), npc_riggle_bassbait::OnGossipHello(), and npc_sayge::OnGossipHello().

◆ IsScriptOverriden()

AuraEffect * Unit::IsScriptOverriden ( SpellInfo const *  spell,
int32  script 
) const
5833{
5835 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5836 {
5837 if ((*i)->GetMiscValue() == script)
5838 if ((*i)->IsAffectedOnSpell(spell))
5839 return (*i);
5840 }
5841 return nullptr;
5842}
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition SpellAuraDefines.h:175

References GetAuraEffectsByType(), and SPELL_AURA_OVERRIDE_CLASS_SCRIPTS.

Referenced by Spell::CheckCast(), Spell::EffectWeaponDmg(), and AuraEffect::HandleAuraModShapeshift().

◆ IsServiceProvider()

bool Unit::IsServiceProvider ( ) const
inline

◆ IsSitState()

bool Unit::IsSitState ( ) const
16735{
16736 uint8 s = getStandState();
16737 return
16741}
@ UNIT_STAND_STATE_SIT_HIGH_CHAIR
Definition UnitDefines.h:38
@ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR
Definition UnitDefines.h:37
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition UnitDefines.h:36
@ UNIT_STAND_STATE_SIT_CHAIR
Definition UnitDefines.h:34

References getStandState(), UNIT_STAND_STATE_SIT, UNIT_STAND_STATE_SIT_CHAIR, UNIT_STAND_STATE_SIT_HIGH_CHAIR, UNIT_STAND_STATE_SIT_LOW_CHAIR, and UNIT_STAND_STATE_SIT_MEDIUM_CHAIR.

Referenced by _ApplyAura(), AttackerStateUpdate(), WorldSession::HandleMovementOpcodes(), IsStandState(), Spell::prepare(), and SpellTakenCritChance().

◆ isSpellBlocked()

bool Unit::isSpellBlocked ( Unit victim,
SpellInfo const *  spellProto,
WeaponAttackType  attackType = BASE_ATTACK 
)
3101{
3102 // These spells can't be blocked
3103 if (spellProto && spellProto->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3104 return false;
3105
3106 if (victim->HasIgnoreHitDirectionAura() || victim->HasInArc(M_PI, this))
3107 {
3108 // Check creatures flags_extra for disable block
3109 if (victim->IsCreature() &&
3111 return false;
3112
3113 float blockChance = victim->GetUnitBlockChance();
3114 blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
3115
3116 // xinef: cant block while casting or while stunned
3117 if (blockChance < 0.0f || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3118 blockChance = 0.0f;
3119
3120 if (roll_chance_f(blockChance))
3121 return true;
3122 }
3123 return false;
3124}
@ CREATURE_FLAG_EXTRA_NO_BLOCK
Definition CreatureData.h:49
@ SPELL_ATTR0_NO_ACTIVE_DEFENSE
Definition SharedDefines.h:403
@ UNIT_STATE_CONTROLLED
Definition UnitDefines.h:211
bool HasIgnoreHitDirectionAura() const
Definition Unit.h:1723
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition Unit.cpp:3790
float GetUnitBlockChance() const
Definition Unit.cpp:3702

References CREATURE_FLAG_EXTRA_NO_BLOCK, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), Object::IsCreature(), IsNonMeleeSpellCast(), roll_chance_f(), SPELL_ATTR0_NO_ACTIVE_DEFENSE, Object::ToCreature(), and UNIT_STATE_CONTROLLED.

Referenced by CalculateSpellDamageTaken().

◆ IsSpiritGuide()

bool Unit::IsSpiritGuide ( ) const
inline

◆ IsSpiritHealer()

bool Unit::IsSpiritHealer ( ) const
inline

◆ IsSpiritService()

◆ IsStandState()

◆ IsStopped()

bool Unit::IsStopped ( ) const
inline
1674{ return !(HasUnitState(UNIT_STATE_MOVING)); }
@ UNIT_STATE_MOVING
Definition UnitDefines.h:210

References HasUnitState(), and UNIT_STATE_MOVING.

Referenced by RotateMovementGenerator::Initialize(), IdleMovementGenerator::Reset(), and SetFacingToObject().

◆ IsSummon()

bool Unit::IsSummon ( ) const
inline
@ UNIT_MASK_SUMMON
Definition UnitDefines.h:156

References m_unitTypeMask, and UNIT_MASK_SUMMON.

Referenced by Creature::CanPeriodicallyCallForAssistance(), spell_item_unsated_craving::CheckProc(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Spell::EffectScriptEffect(), boss_skeram::EnterEvadeMode(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), Spell::finish(), GetAllMinionsByEntry(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pri_lightwell::HandleScriptEffect(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), boss_skeram::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), boss_freya_iron_root::boss_freya_iron_rootAI::JustDied(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::JustDied(), npc_counselor_talbot::npc_counselor_talbotAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::npc_pet_dk_ghoulAI::JustDied(), npc_pet_pri_shadowfiend::JustDied(), boss_skeram::JustEngagedWith(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_leryssa::npc_leryssaAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), BattlefieldWG::OnCreatureCreate(), InstanceScript::OnCreatureCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnCreatureCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnUnitDeath(), RemoveAllControlled(), RemoveAllMinionsByEntry(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), Creature::SaveRespawnTime(), Creature::SearchFormation(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), ToTempSummon(), ToTempSummon(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_skeram::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), and Player::VehicleSpellInitialize().

◆ isSwimming()

◆ IsTabardDesigner()

bool Unit::IsTabardDesigner ( ) const
inline

◆ isTargetableForAttack()

◆ IsTaxi()

bool Unit::IsTaxi ( ) const
inline

◆ IsTotem()

◆ IsTrainer()

◆ IsTriggeredAtSpellProcEvent()

bool Unit::IsTriggeredAtSpellProcEvent ( Unit victim,
Aura aura,
WeaponAttackType  attType,
bool  isVictim,
bool  active,
SpellProcEventEntry const *&  spellProcEvent,
ProcEventInfo const &  eventInfo 
)
private
17447{
17448 SpellInfo const* spellProto = aura->GetSpellInfo();
17449 SpellInfo const* procSpell = eventInfo.GetSpellInfo();
17450
17451 // let the aura be handled by new proc system if it has new entry
17452 if (sSpellMgr->GetSpellProcEntry(spellProto->Id))
17453 return false;
17454
17455 // Get proc Event Entry
17456 spellProcEvent = sSpellMgr->GetSpellProcEvent(spellProto->Id);
17457
17458 // Get EventProcFlag
17459 uint32 EventProcFlag;
17460 if (spellProcEvent && spellProcEvent->procFlags) // if exist get custom spellProcEvent->procFlags
17461 EventProcFlag = spellProcEvent->procFlags;
17462 else
17463 EventProcFlag = spellProto->ProcFlags; // else get from spell proto
17464 // Continue if no trigger exist
17465 if (!EventProcFlag)
17466 return false;
17467
17468 // Additional checks for triggered spells (ignore trap casts)
17469 //if (procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION))
17470 //{
17471 // if (!spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_TRIGGERED))
17472 // return false;
17473 //}
17474
17475 // Xinef: additional check for player auras - only player spells can trigger player proc auras
17476 // Xinef: skip victim auras
17477 // Excluded player shoot spells
17478 // Excluded player item spells
17479 if (!isVictim && IsPlayer() && !(EventProcFlag & (PROC_FLAG_KILL | PROC_FLAG_DEATH)))
17480 {
17481 if (procSpell && procSpell->SpellFamilyName == SPELLFAMILY_GENERIC && procSpell->GetCategory() != 76 &&
17482 (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->m_CastItem) &&
17483 (!eventInfo.GetTriggerAuraSpell() || eventInfo.GetTriggerAuraSpell()->SpellFamilyName == SPELLFAMILY_GENERIC))
17484 {
17485 return false;
17486 }
17487 }
17488
17489 // Check spellProcEvent data requirements
17490 if (!sSpellMgr->IsSpellProcEventCanTriggeredBy(spellProto, spellProcEvent, EventProcFlag, eventInfo, active))
17491 return false;
17492 // In most cases req get honor or XP from kill
17493 if (EventProcFlag & PROC_FLAG_KILL && IsPlayer())
17494 {
17495 bool allow = false;
17496
17497 if (victim)
17498 allow = ToPlayer()->isHonorOrXPTarget(victim);
17499
17500 // Shadow Word: Death - can trigger from every kill
17501 if (aura->GetId() == 32409 || aura->GetId() == 18372 || aura->GetId() == 18213)
17502 allow = true;
17503 if (!allow)
17504 return false;
17505 }
17506 // Aura added by spell can`t trigger from self (prevent drop charges/do triggers)
17507 // But except periodic and kill triggers (can triggered from self)
17508 if (procSpell && procSpell->Id == spellProto->Id
17509 && !(spellProto->ProcFlags & (PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_KILL)))
17510 return false;
17511
17512 // Check if current equipment allows aura to proc
17513 if (!isVictim && IsPlayer() && !spellProto->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT))
17514 {
17515 Player* player = ToPlayer();
17516 if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
17517 {
17518 Item* item = nullptr;
17519 if (attType == BASE_ATTACK)
17521 else if (attType == OFF_ATTACK)
17523 else
17525
17526 if (player->IsInFeralForm())
17527 return false;
17528
17529 if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
17530 return false;
17531 }
17532 else if (spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
17533 {
17534 // Check if player is wearing shield
17536 if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
17537 return false;
17538 }
17539 }
17540 // Get chance from spell
17541 float chance = float(spellProto->ProcChance);
17542 // If in spellProcEvent exist custom chance, chance = spellProcEvent->customChance;
17543 if (spellProcEvent && spellProcEvent->customChance)
17544 chance = spellProcEvent->customChance;
17545 // If PPM exist calculate chance from PPM
17546 if (spellProcEvent && spellProcEvent->ppmRate != 0)
17547 {
17548 if (!isVictim)
17549 {
17550 uint32 WeaponSpeed = GetAttackTime(attType);
17551 chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
17552 }
17553 else if (victim)
17554 {
17555 uint32 WeaponSpeed = victim->GetAttackTime(attType);
17556 chance = victim->GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
17557 }
17558 }
17559
17560 // Custom chances
17561 switch (spellProto->SpellFamilyName)
17562 {
17564 {
17565 // Recklessness, allow to proc only once for whirlwind
17566 if (spellProto->Id == 1719 && procSpell && procSpell->Id == 44949)
17567 return false;
17568 }
17569 }
17570
17571 if (eventInfo.GetProcChance())
17572 {
17573 chance = *eventInfo.GetProcChance();
17574 }
17575
17576 // Apply chance modifer aura
17577 if (Player* modOwner = GetSpellModOwner())
17578 {
17579 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
17580 }
17581
17582 return roll_chance_f(chance);
17583}
@ ITEM_CLASS_ARMOR
Definition ItemTemplate.h:295
@ ITEM_CLASS_WEAPON
Definition ItemTemplate.h:293
@ EQUIPMENT_SLOT_RANGED
Definition Player.h:697
@ SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT
Definition SharedDefines.h:494
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition SpellDefines.h:94
@ PROC_FLAG_DEATH
Definition SpellMgr.h:143
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:135
@ PROC_FLAG_KILL
Definition SpellMgr.h:108
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition Player.h:1261
bool isHonorOrXPTarget(Unit *victim) const
Definition Player.cpp:12701
uint32 GetCategory() const
Definition SpellInfo.cpp:871
int32 EquippedItemClass
Definition SpellInfo.h:375
uint32 ProcFlags
Definition SpellInfo.h:355
int32 EquippedItemSubClassMask
Definition SpellInfo.h:376
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
Definition Unit.cpp:13474
uint32 Class
Definition ItemTemplate.h:621

References BASE_ATTACK, ItemTemplate::Class, SpellProcEventEntry::customChance, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, SpellInfo::EquippedItemClass, SpellInfo::EquippedItemSubClassMask, GetAttackTime(), SpellInfo::GetCategory(), Aura::GetId(), GetPPMProcChance(), ProcEventInfo::GetProcChance(), ProcEventInfo::GetProcSpell(), ProcEventInfo::GetSpellInfo(), Aura::GetSpellInfo(), GetSpellModOwner(), Item::GetTemplate(), ProcEventInfo::GetTriggerAuraSpell(), Player::GetUseableItemByPos(), SpellInfo::HasAttribute(), SpellInfo::Id, INVENTORY_SLOT_BAG_0, Item::IsBroken(), Player::isHonorOrXPTarget(), IsInFeralForm(), Object::IsPlayer(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, Spell::m_CastItem, OFF_ATTACK, SpellProcEventEntry::ppmRate, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_TAKEN_PERIODIC, SpellInfo::ProcChance, SpellInfo::ProcFlags, SpellProcEventEntry::procFlags, roll_chance_f(), SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT, SPELLFAMILY_GENERIC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyName, SPELLMOD_CHANCE_OF_SUCCESS, sSpellMgr, ItemTemplate::SubClass, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ isTurning()

bool Unit::isTurning ( ) const
inline

◆ IsUnderLastManaUseEffect()

bool Unit::IsUnderLastManaUseEffect ( ) const

◆ IsUnderWater()

bool Unit::IsUnderWater ( ) const
virtual
4345{
4347}
@ LIQUID_MAP_UNDER_WATER
Definition Map.h:146

References WorldObject::GetLiquidData(), LIQUID_MAP_UNDER_WATER, and LiquidData::Status.

Referenced by Creature::setDeathState().

◆ IsValidAssistTarget()

bool Unit::IsValidAssistTarget ( Unit const *  target) const
14018{
14019 return _IsValidAssistTarget(target, nullptr);
14020}
bool _IsValidAssistTarget(Unit const *target, SpellInfo const *bySpell) const
Definition Unit.cpp:14023

References _IsValidAssistTarget().

Referenced by SmartAI::AssistPlayerInCombatAgainst().

◆ IsValidAttackTarget()

bool Unit::IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell = nullptr 
) const
13895{
13896 return _IsValidAttackTarget(target, bySpell);
13897}

References _IsValidAttackTarget().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), CreatureGroup::GetNewTargetForMember(), WorldSession::HandleAttackSwingOpcode(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), npc_beryl_sorcerer::npc_beryl_sorcererAI::JustEngagedWith(), CreatureGroup::MemberEngagingTarget(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestHostileUnitCheck::operator()(), MalleableGooSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), CreatureAI::SetGazeOn(), StopAttackingInvalidTarget(), SimpleCharmedAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateCharmedAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ IsVehicle()

bool Unit::IsVehicle ( ) const
inline

◆ IsVendor()

◆ IsVisible()

bool Unit::IsVisible ( ) const
inline
@ SEC_PLAYER
Definition Common.h:57
@ SERVERSIDE_VISIBILITY_GM
Definition SharedDefines.h:1273
T_VALUES GetValue(FLAG_TYPE flag) const
Definition Object.h:376

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::GetValue(), WorldObject::m_serverSideVisibility, SEC_PLAYER, and SERVERSIDE_VISIBILITY_GM.

Referenced by npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::CanAIAttack(), boss_professor_putricide::boss_professor_putricideAI::CanAIAttack(), boss_sindragosa::boss_sindragosaAI::CanAIAttack(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), SpellInfo::CheckTarget(), AuraEffect::HandlePhase(), Player::IsVisibleGloballyFor(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), Acore::AllFriendlyCreaturesInGrid::operator()(), boss_sapphiron::boss_sapphironAI::Reset(), npc_pos_leader::npc_pos_leaderAI::SetData(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_taldaram::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), and boss_vazruden_the_herald::UpdateAI().

◆ IsWalking()

◆ IsWithinCombatRange()

bool Unit::IsWithinCombatRange ( Unit const *  obj,
float  dist2compare 
) const

◆ IsWithinMeleeRange()

bool Unit::IsWithinMeleeRange ( Unit const *  obj,
float  dist = 0.f 
) const
665{
666 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
667 return false;
668
669 float dx = GetPositionX() - obj->GetPositionX();
670 float dy = GetPositionY() - obj->GetPositionY();
671 float dz = GetPositionZ() - obj->GetPositionZ();
672 float distsq = dx * dx + dy * dy + dz * dz;
673
674 float maxdist = dist + GetMeleeRange(obj);
675
676 return distsq < maxdist * maxdist;
677}

References GetMeleeRange(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_marli::_chargePlayer(), boss_swamplord_muselek::AttackStart(), SmartAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::CanAIAttack(), boss_ouro::CanAIAttack(), boss_murmur::CanAIAttack(), boss_alar::CanAIAttack(), PetAI::CanAttack(), Spell::CheckRange(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), spell_shazzrah_gate_dummy::FilterTargets(), boss_supremus::FindHatefulStrikeTarget(), boss_ouro::IsPlayerWithinMeleeRange(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), boss_swamplord_muselek::JustEngagedWith(), boss_vem::JustEngagedWith(), CreatureAI::MoveCircleChecks(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), SpellTargetSelector::operator()(), SmartScript::ProcessEvent(), ThreatContainer::SelectNextVictim(), boss_murmur::ShouldCastResonance(), boss_quartermaster_zigris::SpellHitTarget(), Player::Update(), boss_quartermaster_zigris::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_skeram::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_skarvald_the_constructor::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), PetAI::UpdateAI(), npc_zuljin_vortex::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), and boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI().

◆ IsWithinRange()

bool Unit::IsWithinRange ( Unit const *  obj,
float  dist 
) const
686{
687 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
688 {
689 return false;
690 }
691
692 auto dx = GetPositionX() - obj->GetPositionX();
693 auto dy = GetPositionY() - obj->GetPositionY();
694 auto dz = GetPositionZ() - obj->GetPositionZ();
695 auto distsq = dx * dx + dy * dy + dz * dz;
696
697 return distsq <= dist * dist;
698}

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_swamplord_muselek::CanShootVictim().

◆ JumpTo() [1/2]

void Unit::JumpTo ( float  speedXY,
float  speedZ,
bool  forward = true 
)
19548{
19549 float angle = forward ? 0 : M_PI;
19550 if (IsCreature())
19551 GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
19552 else
19553 {
19554 float vcos = cos(angle + GetOrientation());
19555 float vsin = std::sin(angle + GetOrientation());
19556
19557 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
19558 data << GetPackGUID();
19559 data << uint32(0); // Sequence
19560 data << float(vcos); // x direction
19561 data << float(vsin); // y direction
19562 data << float(speedXY); // Horizontal speed
19563 data << float(-speedZ); // Z Movement speed (vertical)
19564
19565 ToPlayer()->GetSession()->SendPacket(&data);
19566 }
19567}
void MoveJumpTo(float angle, float speedXY, float speedZ)
The unit will jump in a specific direction.
Definition MotionMaster.cpp:587
WorldSession * GetSession() const
Definition Player.h:2001
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition WorldSession.cpp:225
@ SMSG_MOVE_KNOCK_BACK
Definition Opcodes.h:269

References GetMotionMaster(), Position::GetOrientation(), Object::GetPackGUID(), Player::GetSession(), Object::IsCreature(), MotionMaster::MoveJumpTo(), WorldSession::SendPacket(), SMSG_MOVE_KNOCK_BACK, and Object::ToPlayer().

Referenced by Spell::EffectLeapBack().

◆ JumpTo() [2/2]

void Unit::JumpTo ( WorldObject obj,
float  speedZ 
)
19570{
19571 float x, y, z;
19572 obj->GetContactPoint(this, x, y, z);
19573 float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
19574 GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
19575}
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=0)
Definition MotionMaster.h:229
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition Object.cpp:2755

References WorldObject::GetContactPoint(), Position::GetExactDist2d(), GetMotionMaster(), and MotionMaster::MoveJump().

◆ Kill()

void Unit::Kill ( Unit killer,
Unit victim,
bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
static
Todo:
: do instance binding anyway if the charmer/owner is offline
17726{
17727 // Prevent killing unit twice (and giving reward from kill twice)
17728 if (!victim->GetHealth())
17729 return;
17730
17731 if (killer && !killer->IsInMap(victim))
17732 killer = nullptr;
17733
17734 // find player: owner of controlled `this` or `this` itself maybe
17735 Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr;
17736 Creature* creature = victim->ToCreature();
17737
17738 bool isRewardAllowed = true;
17739 if (creature)
17740 {
17741 isRewardAllowed = creature->IsDamageEnoughForLootingAndReward();
17742 if (!isRewardAllowed)
17743 creature->SetLootRecipient(nullptr);
17744 }
17745
17746 // pussywizard: remade this if section (player is on the same map
17747 if (isRewardAllowed && creature)
17748 {
17749 Player* lr = creature->GetLootRecipient();
17750 if (lr && lr->IsInMap(creature))
17751 player = creature->GetLootRecipient();
17752 else if (Group* lrg = creature->GetLootRecipientGroup())
17753 for (GroupReference* itr = lrg->GetFirstMember(); itr != nullptr; itr = itr->next())
17754 if (Player* member = itr->GetSource())
17755 if (member->IsAtLootRewardDistance(creature))
17756 {
17757 player = member;
17758 break;
17759 }
17760 }
17761
17762 // Exploit fix
17763 if (creature && creature->IsPet() && creature->GetOwnerGUID().IsPlayer())
17764 isRewardAllowed = false;
17765
17766 // Reward player, his pets, and group/raid members
17767 // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
17768 if (isRewardAllowed && player && player != victim)
17769 {
17770 WorldPacket data(SMSG_PARTYKILLLOG, (8 + 8)); // send event PARTY_KILL
17771 data << player->GetGUID(); // player with killing blow
17772 data << victim->GetGUID(); // victim
17773
17774 Player* looter = player;
17775 Group* group = player->GetGroup();
17776 bool hasLooterGuid = false;
17777
17778 if (group)
17779 {
17780 group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID()));
17781
17782 if (creature)
17783 {
17784 group->UpdateLooterGuid(creature, true);
17785 if (group->GetLooterGuid() && group->GetLootMethod() != FREE_FOR_ALL)
17786 {
17787 looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
17788 if (looter)
17789 {
17790 hasLooterGuid = true;
17791 creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
17792 }
17793 }
17794 }
17795 }
17796 else
17797 {
17798 player->SendDirectMessage(&data);
17799
17800 if (creature)
17801 {
17802 WorldPacket data2(SMSG_LOOT_LIST, 8 + 1 + 1);
17803 data2 << creature->GetGUID();
17804 data2 << uint8(0); // unk1
17805 data2 << uint8(0); // no group looter
17806 player->SendMessageToSet(&data2, true);
17807 }
17808 }
17809
17810 // Generate loot before updating looter
17811 if (creature)
17812 {
17813 Loot* loot = &creature->loot;
17814 loot->clear();
17815
17816 if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
17817 loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode(), creature);
17818
17819 if (creature->GetLootMode())
17821
17822 if (group)
17823 {
17824 if (hasLooterGuid)
17825 group->SendLooter(creature, looter);
17826 else
17827 group->SendLooter(creature, nullptr);
17828
17829 // Update round robin looter only if the creature had loot
17830 if (!creature->loot.empty())
17831 group->UpdateLooterGuid(creature);
17832 }
17833 }
17834
17835 player->RewardPlayerAndGroupAtKill(victim, false);
17836 }
17837
17838 // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim
17839 if (killer && (killer->IsPet() || killer->IsTotem()))
17840 if (Unit* owner = killer->GetOwner())
17841 {
17842 Unit::ProcDamageAndSpell(owner, victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17843 sScriptMgr->OnCreatureKilledByPet( killer->GetCharmerOrOwnerPlayerOrPlayerItself(), victim->ToCreature());
17844 }
17845
17846 if (killer != victim)
17847 {
17848 Unit::ProcDamageAndSpell(killer, victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17849 }
17850
17851 // Proc auras on death - must be before aura/combat remove
17852 Unit::ProcDamageAndSpell(victim, nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17853
17854 // update get killing blow achievements, must be done before setDeathState to be able to require auras on target
17855 // and before Spirit of Redemption as it also removes auras
17856 if (killer)
17857 if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
17858 killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
17859
17860 // Spirit of Redemption
17861 // if talent known but not triggered (check priest class for speedup check)
17862 bool spiritOfRedemption = false;
17864 {
17865 if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711))
17866 {
17867 // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift
17868 if (victim->HasSpiritOfRedemptionAura() || victim->HasAura(27827))
17869 {
17870 /*LOG_INFO("misc", "Player ({}) died with spirit of redemption. Killer (Entry: {}, Name: {}), Map: {}, x: {}, y: {}, z: {}",
17871 victim->GetGUID().ToString(), killer ? killer->GetEntry() : 1, killer ? killer->GetName() : "", victim->GetMapId(), victim->GetPositionX(),
17872 victim->GetPositionY(), victim->GetPositionZ());
17873
17874 ACE_Stack_Trace trace(0, 50);
17875 LOG_INFO("misc", "TRACE: {}\n\n", trace);*/
17876 }
17877 else
17878 {
17879 // save value before aura remove
17880 uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL);
17881 if (!ressSpellId)
17882 ressSpellId = victim->ToPlayer()->GetResurrectionSpellId();
17883
17884 //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers)
17885 victim->RemoveAllAurasOnDeath();
17886
17887 // Stop attacks
17888 victim->CombatStop();
17890
17891 // restore for use at real death
17892 victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
17893
17894 // FORM_SPIRITOFREDEMPTION and related auras
17895 victim->CastSpell(victim, 27827, true, nullptr, aurEff);
17896 spiritOfRedemption = true;
17897 }
17898 }
17899 }
17900
17901 if (!spiritOfRedemption)
17902 {
17903 LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
17905 }
17906
17907 // Inform pets (if any) when player kills target)
17908 // MUST come after victim->setDeathState(DeathState::JustDied); or pet next target
17909 // selection will get stuck on same target and break pet react state
17910 if (player)
17911 {
17912 Pet* pet = player->GetPet();
17913 if (pet && pet->IsAlive() && pet->isControlled())
17914 pet->AI()->KilledUnit(victim);
17915 }
17916
17917 // 10% durability loss on death
17918 // clean InHateListOf
17919 if (Player* plrVictim = victim->ToPlayer())
17920 {
17921 // remember victim PvP death for corpse type and corpse reclaim delay
17922 // at original death (not at SpiritOfRedemtionTalent timeout)
17923 plrVictim->SetPvPDeath(player != nullptr);
17924
17925 // only if not player and not controlled by player pet. And not at BG
17926 if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
17927 {
17928 LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
17929 plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false);
17930 // durability lost message
17931 plrVictim->SendDurabilityLoss();
17932 }
17933 // Call KilledUnit for creatures
17934 if (killer && killer->IsCreature() && killer->IsAIEnabled)
17935 killer->ToCreature()->AI()->KilledUnit(victim);
17936
17937 // last damage from non duel opponent or opponent controlled creature
17938 if (plrVictim->duel)
17939 {
17940 plrVictim->duel->Opponent->CombatStopWithPets(true);
17941 plrVictim->CombatStopWithPets(true);
17942 plrVictim->DuelComplete(DUEL_INTERRUPTED);
17943 }
17944 }
17945 else // creature died
17946 {
17947 LOG_DEBUG("entities.unit", "DealDamageNotPlayer");
17948
17949 if (!creature->IsPet() && creature->GetLootMode() > 0)
17950 {
17951 creature->GetThreatMgr().ClearAllThreat();
17952
17953 // must be after setDeathState which resets dynamic flags
17954 if (!creature->loot.isLooted())
17955 {
17957 }
17958 else
17959 {
17960 creature->AllLootRemovedFromCorpse();
17961 }
17962 }
17963
17964 // Call KilledUnit for creatures, this needs to be called after the lootable flag is set
17965 if (killer && killer->IsCreature() && killer->IsAIEnabled)
17966 killer->ToCreature()->AI()->KilledUnit(victim);
17967
17968 // Call creature just died function
17969 if (CreatureAI* ai = creature->AI())
17970 {
17971 ai->JustDied(killer);
17972 }
17973
17974 if (TempSummon* summon = creature->ToTempSummon())
17975 {
17976 if (WorldObject* summoner = summon->GetSummoner())
17977 {
17978 if (summoner->ToCreature() && summoner->ToCreature()->IsAIEnabled)
17979 {
17980 summoner->ToCreature()->AI()->SummonedCreatureDies(creature, killer);
17981 }
17982 else if (summoner->ToGameObject() && summoner->ToGameObject()->AI())
17983 {
17984 summoner->ToGameObject()->AI()->SummonedCreatureDies(creature, killer);
17985 }
17986 }
17987 }
17988
17989 // Dungeon specific stuff, only applies to players killing creatures
17990 if (creature->GetInstanceId())
17991 {
17992 Map* instanceMap = creature->GetMap();
17993 //Player* creditedPlayer = GetCharmerOrOwnerPlayerOrPlayerItself();
17995
17996 if (instanceMap->IsDungeon() && player)
17997 if (instanceMap->IsRaidOrHeroicDungeon())
17999 instanceMap->ToInstanceMap()->PermBindAllPlayers();
18000 }
18001 }
18002
18003 // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
18004 // handle player kill only if not suicide (spirit of redemption for example)
18005 if (player && killer != victim)
18006 {
18007 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
18008 pvp->HandleKill(player, victim);
18009
18010 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
18011 bf->HandleKill(player, victim);
18012 }
18013
18014 //if (victim->IsPlayer())
18015 // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
18016 // pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
18017
18018 // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
18019 if (player)
18020 if (Battleground* bg = player->GetBattleground())
18021 {
18022 if (victim->IsPlayer())
18023 bg->HandleKillPlayer(victim->ToPlayer(), player);
18024 else
18025 bg->HandleKillUnit(victim->ToCreature(), player);
18026 }
18027
18028 // achievement stuff
18029 if (killer && victim->IsPlayer())
18030 {
18031 if (killer->IsCreature())
18033 else if (victim != killer && killer->IsPlayer())
18035 }
18036
18037 // Hook for OnPVPKill Event
18038 if (killer)
18039 {
18040 if (Player* killerPlr = killer->ToPlayer())
18041 {
18042 if (Player* killedPlr = victim->ToPlayer())
18043 sScriptMgr->OnPVPKill(killerPlr, killedPlr);
18044 else if (Creature* killedCre = victim->ToCreature())
18045 sScriptMgr->OnCreatureKill(killerPlr, killedCre);
18046 }
18047 else if (Creature* killerCre = killer->ToCreature())
18048 {
18049 if (Player* killed = victim->ToPlayer())
18050 sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
18051 }
18052 }
18053
18054 sScriptMgr->OnUnitDeath(victim, killer);
18055}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:77
@ CREATURE_FLAG_EXTRA_INSTANCE_BIND
Definition CreatureData.h:45
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER
Definition DBCEnums.h:138
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE
Definition DBCEnums.h:137
@ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS
Definition DBCEnums.h:170
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition IWorld.h:66
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition IWorld.h:515
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
@ FREE_FOR_ALL
Definition LootMgr.h:58
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition Player.h:493
@ UNIT_DYNFLAG_LOOTABLE
Definition SharedDefines.h:3121
@ DUEL_INTERRUPTED
Definition SharedDefines.h:3612
@ PROC_FLAG_KILLED
Definition SpellMgr.h:107
@ PLAYER_SELF_RES_SPELL
Definition UpdateFields.h:370
Definition Battlefield.h:204
Definition CreatureAI.h:70
virtual void KilledUnit(Unit *)
Definition CreatureAI.h:131
Loot loot
Definition Creature.h:226
uint16 GetLootMode() const
Definition Creature.h:240
void AllLootRemovedFromCorpse()
Definition Creature.cpp:2988
Player * GetLootRecipient() const
Definition Creature.cpp:1306
bool IsDamageEnoughForLootingAndReward() const
Definition Creature.cpp:3801
Group * GetLootRecipientGroup() const
Definition Creature.cpp:1313
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition Group.cpp:1753
uint8 GetMemberGroup(ObjectGuid guid) const
Definition Group.cpp:2380
ObjectGuid GetLooterGuid() const
Definition Group.cpp:2317
LootMethod GetLootMethod() const
Definition Group.cpp:2312
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition Group.cpp:1864
void SendLooter(Creature *creature, Player *pLooter)
Definition Group.cpp:965
void PermBindAllPlayers()
Definition Map.cpp:3155
Definition Map.h:311
bool IsRaidOrHeroicDungeon() const
Definition Map.h:449
InstanceMap * ToInstanceMap()
Definition Map.h:544
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:123
Definition OutdoorPvP.h:185
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5723
TeamId GetTeamId(bool original=false) const
Definition Player.h:2111
Battleground * GetBattleground(bool create=false) const
Definition Player.cpp:12228
uint32 GetResurrectionSpellId()
Definition Player.cpp:12644
OutdoorPvP * GetOutdoorPvP() const
Definition Player.cpp:12545
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition Player.cpp:12764
void RemoveAllAurasOnDeath()
Definition Unit.cpp:5349
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition Unit.cpp:5550
uint32 GetInstanceId() const
Definition Object.h:448
uint32 GetZoneId() const
Definition Object.cpp:3159
@ SMSG_PARTYKILLLOG
Definition Opcodes.h:531
@ SMSG_LOOT_LIST
Definition Opcodes.h:1047
Player * FindPlayer(ObjectGuid const guid)
Definition ObjectAccessor.cpp:245
uint32 mingold
Definition CreatureData.h:231
uint32 maxgold
Definition CreatureData.h:232
uint32 lootid
Definition CreatureData.h:224
Definition LootMgr.h:313
bool empty() const
Definition LootMgr.h:367
bool isLooted() const
Definition LootMgr.h:368
void clear()
Definition LootMgr.h:343
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition LootMgr.cpp:837
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition LootMgr.cpp:570

References ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, Creature::AI(), Creature::AllLootRemovedFromCorpse(), Group::BroadcastPacket(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_PRIEST, Loot::clear(), ThreatMgr::ClearAllThreat(), CombatStop(), CONFIG_DURABILITY_LOSS_IN_PVP, CREATURE_FLAG_EXTRA_INSTANCE_BIND, HostileRefMgr::deleteReferences(), DUEL_INTERRUPTED, Loot::empty(), Loot::FillLoot(), ObjectAccessor::FindPlayer(), CreatureTemplate::flags_extra, FREE_FOR_ALL, Loot::generateMoneyLoot(), GetAuraEffectDummy(), Player::GetBattleground(), GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), Object::GetEntry(), Player::GetGroup(), Object::GetGUID(), GetHealth(), getHostileRefMgr(), WorldObject::GetInstanceId(), Group::GetLooterGuid(), Group::GetLootMethod(), Creature::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), WorldObject::GetMap(), Group::GetMemberGroup(), Player::GetOutdoorPvP(), GetOwner(), GetOwnerGUID(), Player::GetPet(), Player::GetResurrectionSpellId(), Player::GetTeamId(), GetThreatMgr(), Object::GetUInt32Value(), WorldObject::GetZoneId(), HasAura(), Player::HasPlayerFlag(), HasSpiritOfRedemptionAura(), Player::InBattleground(), IsAIEnabled, IsAlive(), IsClass(), Pet::isControlled(), Object::IsCreature(), Creature::IsDamageEnoughForLootingAndReward(), Map::IsDungeon(), WorldObject::IsInMap(), Loot::isLooted(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), Map::IsRaidOrHeroicDungeon(), IsTotem(), JustDied, CreatureAI::KilledUnit(), LOG_DEBUG, Creature::loot, CreatureTemplate::lootid, LootTemplates_Creature, CreatureTemplate::maxgold, CreatureTemplate::mingold, InstanceMap::PermBindAllPlayers(), PLAYER_FLAGS_IS_OUT_OF_BOUNDS, PLAYER_SELF_RES_SPELL, PROC_EX_NONE, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_FLAG_NONE, ProcDamageAndSpell(), RATE_DURABILITY_LOSS_ON_DEATH, RemoveAllAurasOnDeath(), Player::RewardPlayerAndGroupAtKill(), sBattlefieldMgr, Player::SendDirectMessage(), Group::SendLooter(), Player::SendMessageToSet(), setDeathState(), Object::SetDynamicFlag(), Creature::SetLootRecipient(), SetUInt32Value(), SMSG_LOOT_LIST, SMSG_PARTYKILLLOG, sScriptMgr, sWorld, Object::ToCreature(), Map::ToInstanceMap(), Object::ToPlayer(), ToTempSummon(), UNIT_DYNFLAG_LOOTABLE, Player::UpdateAchievementCriteria(), and Group::UpdateLooterGuid().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), boss_headless_horseman_head::DamageTaken(), boss_viscidus::DamageTaken(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), DealDamage(), boss_jedoga_shadowseeker::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_illidari_council::DoAction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), DeathEvent::Execute(), AuraEffect::HandleAuraControlVehicle(), BattlegroundIC::HandleCapturedNodes(), misc_commandscript::HandleDieCommand(), spell_ooze_zap_channel_end::HandleDummy(), spell_pos_rimefang_frost_nova::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_yogg_saron_titanic_storm::HandleDummyEffect(), spell_item_rocket_chicken::HandleDummyTick(), spell_ulduar_arachnopod_damaged_aura::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_teron_gorefiend_spiritual_vengeance::HandleEffectRemove(), spell_voa_overcharge_aura::HandlePeriodicDummy(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_leotheras_clear_consuming_madness::HandleScriptEffect(), boss_twin_valkyrAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_sister_svalna::boss_sister_svalnaAI::JustDied(), boss_ignis::boss_ignisAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), boss_ahune::JustDied(), npc_frozen_core::JustDied(), boss_twinemperorsAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), KillSelf(), boss_buru::ManipulateEggs(), npc_burning_spirit::npc_burning_spiritAI::MovementInform(), spell_yogg_saron_insane_aura::OnRemove(), WretchedGhoulCleaner::operator()(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::PassengerBoarded(), SmartScript::ProcessAction(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::RandomizeCompositionsAndShow(), boss_faerlina::boss_faerlinaAI::SpellHit(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::Update(), SimpleCharmedAI::UpdateAI(), npc_crusade_persuaded::npc_crusade_persuadedAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ KillSelf()

void Unit::KillSelf ( bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
inline
1165{ Kill(this, this, durabilityLoss, attackType, spellProto, spell); };

References Kill().

Referenced by boss_felblood_kaelthas::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_illidari_council::DoAction(), npc_xt002_boombot::npc_xt002_boombotAI::Explode(), npc_raging_flames::FixateRandomTarget(), npc_rancid_mushroom::InitializeAI(), boss_warlord_kalithresh::JustDied(), npc_pet_gen_plump_turkey::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), npc_announcer_toc5::npc_announcer_toc5AI::MovementInform(), boss_glob_of_viscidus::MovementInform(), SmartScript::ProcessAction(), npc_singularity::Reset(), boss_archimonde::Reset(), npc_dark_iron_guzzler::SpellHit(), boss_victor_nefarius::boss_victor_nefariusAI::SummonedCreatureDies(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDies(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::SummonedCreatureDies(), boss_vazruden_the_herald::SummonedCreatureDies(), npc_warden_mellichar::npc_warden_mellicharAI::SummonedCreatureDies(), npc_brewfest_super_brew_trigger::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and npc_frost_tomb::UpdateAI().

◆ KnockbackFrom()

void Unit::KnockbackFrom ( float  x,
float  y,
float  speedXY,
float  speedZ 
)
19167{
19168 Player* player = ToPlayer();
19169 if (!player)
19170 {
19171 if (Unit* charmer = GetCharmer())
19172 {
19173 player = charmer->ToPlayer();
19174 if (player && player->m_mover != this)
19175 player = nullptr;
19176 }
19177 }
19178
19179 if (!player)
19180 {
19181 GetMotionMaster()->MoveKnockbackFrom(x, y, speedXY, speedZ);
19182 }
19183 else
19184 {
19185 float vcos, vsin;
19186 GetSinCos(x, y, vsin, vcos);
19187
19188 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
19189 data << GetPackGUID();
19190 data << uint32(0); // counter
19191 data << float(vcos); // x direction
19192 data << float(vsin); // y direction
19193 data << float(speedXY); // Horizontal speed
19194 data << float(-speedZ); // Z Movement speed (vertical)
19195
19196 player->GetSession()->SendPacket(&data);
19197
19198 if (player->HasIncreaseMountedFlightSpeedAura() || player->HasFlyAura())
19199 player->SetCanFly(true, true);
19200
19201 player->SetCanKnockback(true);
19202 }
19203}
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
Definition MotionMaster.cpp:558
SafeUnitPointer m_mover
Definition Player.h:2336
void SetCanKnockback(bool value)
Definition Player.h:2503
bool SetCanFly(bool apply, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Player.cpp:15951
bool HasFlyAura() const
Definition Unit.h:1714
bool HasIncreaseMountedFlightSpeedAura() const
Definition Unit.h:1741
void GetSinCos(float x, float y, float &vsin, float &vcos) const
Definition Position.cpp:92

References GetCharmer(), GetMotionMaster(), Object::GetPackGUID(), Player::GetSession(), Position::GetSinCos(), HasFlyAura(), HasIncreaseMountedFlightSpeedAura(), Player::m_mover, MotionMaster::MoveKnockbackFrom(), WorldSession::SendPacket(), Player::SetCanFly(), Player::SetCanKnockback(), SMSG_MOVE_KNOCK_BACK, and Object::ToPlayer().

Referenced by _ExitVehicle(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), Spell::EffectKnockBack(), spell_warhead_detonate::HandleDummy(), npc_vekjik::OnGossipSelect(), and npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI().

◆ MagicSpellHitResult()

SpellMissInfo Unit::MagicSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3328{
3329 // Can`t miss on dead target (on skinning for example)
3330 if (!victim->IsAlive() && !victim->IsPlayer())
3331 return SPELL_MISS_NONE;
3332
3333 // vehicles cant miss
3334 if (IsVehicle())
3335 return SPELL_MISS_NONE;
3336
3337 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3338 // resist and deflect chances
3339 // xinef: skip all calculations, proof: Toxic Tolerance quest
3340 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3341 return SPELL_MISS_NONE;
3342
3343 if (spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
3344 {
3345 return SPELL_MISS_NONE;
3346 }
3347
3348 SpellSchoolMask schoolMask = spellInfo->GetSchoolMask();
3349 int32 thisLevel = getLevelForTarget(victim);
3350 if (IsCreature() && ToCreature()->IsTrigger())
3351 thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
3352 int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
3353
3354 int32 MISS_CHANCE_MULTIPLIER;
3355 if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && !IsPlayer()) // keep it as it was originally (7 and 11)
3356 {
3357 MISS_CHANCE_MULTIPLIER = victim->IsPlayer() ? 7 : 11;
3358 }
3359 else
3360 {
3361 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
3362 victim->IsPlayer()
3365 }
3366
3367 // Base hit chance from attacker and victim levels
3368 int32 modHitChance = levelDiff < 3
3369 ? 96 - levelDiff
3370 : 94 - (levelDiff - 2) * MISS_CHANCE_MULTIPLIER;
3371
3372 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
3373 if (Player* modOwner = GetSpellModOwner())
3374 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
3375
3376 // Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
3378
3379 // Spells with SPELL_ATTR3_ALWAYS_HIT will ignore target's avoidance effects
3380 // xinef: imo it should completly ignore all calculations, eg: 14792. Hits 80 level players on blizz without any problems
3381 //if (!spell->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3382 {
3383 // Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
3385 // Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
3386 if (spellInfo->IsAffectingArea())
3387 modHitChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
3388
3389 // Decrease hit chance from victim rating bonus
3390 if (victim->IsPlayer())
3391 modHitChance -= int32(victim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL));
3392 }
3393
3394 int32 HitChance = modHitChance * 100;
3395 // Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
3396 // Xinef: Totems should inherit casters ratings?
3397 if (IsTotem())
3398 {
3399 if (Unit* owner = GetOwner())
3400 HitChance += int32(owner->m_modSpellHitChance * 100.0f);
3401 }
3402 else
3403 HitChance += int32(m_modSpellHitChance * 100.0f);
3404
3405 if (HitChance < 100)
3406 HitChance = 100;
3407 else if (HitChance > 10000)
3408 HitChance = 10000;
3409
3410 int32 tmp = 10000 - HitChance;
3411
3412 int32 rand = irand(1, 10000); // Needs to be 1 to 10000 to avoid the 1/10000 chance to miss on 100% hit rating
3413
3414 if (rand < tmp)
3415 return SPELL_MISS_MISS;
3416
3417 // Chance resist mechanic (select max value from every mechanic spell effect)
3418 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3419 tmp += resist_chance;
3420
3421 // Chance resist debuff
3422 if (!spellInfo->IsPositive() && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))
3423 {
3424 bool bNegativeAura = true;
3425 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3426 {
3427 // Xinef: Check if effect exists!
3428 if (spellInfo->Effects[i].IsEffect() && spellInfo->Effects[i].ApplyAuraName == 0)
3429 {
3430 bNegativeAura = false;
3431 break;
3432 }
3433 }
3434
3435 if (bNegativeAura)
3436 {
3437 tmp += victim->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3438 tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3439 }
3440
3441 // Players resistance for binary spells
3442 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_HOLY)) == 0)
3443 tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage
3444 }
3445
3446 // Roll chance
3447 if (rand < tmp)
3448 return SPELL_MISS_RESIST;
3449
3450 // cast by caster in front of victim
3451 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
3452 {
3453 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3454 tmp += deflect_chance;
3455 if (rand < tmp)
3456 return SPELL_MISS_DEFLECT;
3457 }
3458
3459 return SPELL_MISS_NONE;
3460}
@ CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS
Definition IWorld.h:173
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
Definition IWorld.h:523
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
Definition IWorld.h:522
@ SPELL_ATTR7_NO_ATTACK_MISS
Definition SharedDefines.h:666
@ SPELL_MISS_NONE
Definition SharedDefines.h:1519
@ SPELL_MISS_RESIST
Definition SharedDefines.h:1521
@ SPELL_MISS_MISS
Definition SharedDefines.h:1520
@ SPELL_MISS_DEFLECT
Definition SharedDefines.h:1528
@ SPELL_AURA_MOD_DEBUFF_RESISTANCE
Definition SpellAuraDefines.h:241
@ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
Definition SpellAuraDefines.h:262
@ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE
Definition SpellAuraDefines.h:249
@ SPELL_AURA_MOD_AOE_AVOIDANCE
Definition SpellAuraDefines.h:223
@ SPELLMOD_RESIST_MISS_CHANCE
Definition SpellDefines.h:92
@ CR_HIT_TAKEN_SPELL
Definition Unit.h:230
float GetRatingBonusValue(CombatRating cr) const
Definition Player.cpp:5216
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6075
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition Unit.cpp:6061
int32 GetMechanicResistChance(SpellInfo const *spell)
Definition Unit.cpp:3133

References CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS, CR_HIT_TAKEN_SPELL, SpellInfo::Dispel, SpellInfo::Effects, GetEffectiveResistChance(), getLevelForTarget(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifierByMiscValue(), GetMechanicResistChance(), GetOwner(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, irand(), SpellInfo::IsAffectingArea(), IsAlive(), Object::IsCreature(), Object::IsPlayer(), SpellInfo::IsPositive(), IsTotem(), IsVehicle(), m_modSpellHitChance, MAX_SPELL_EFFECTS, RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE, RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER, SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_NO_CAST_LOG, SPELL_ATTR7_NO_ATTACK_MISS, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_MOD_AOE_AVOIDANCE, SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, SPELL_AURA_MOD_DEBUFF_RESISTANCE, SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, SPELL_MISS_DEFLECT, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_RESIST, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NORMAL, SpellInfo::SpellLevel, SPELLMOD_RESIST_MISS_CHANCE, sWorld, Object::ToCreature(), Object::ToPlayer(), and UNIT_STATE_STUNNED.

Referenced by SpellHitResult(), and SpellHitResult().

◆ MeleeDamageBonusDone()

uint32 Unit::MeleeDamageBonusDone ( Unit pVictim,
uint32  damage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
13098{
13099 if (!victim || pdamage == 0)
13100 return 0;
13101
13102 if (IsCreature())
13103 {
13104 // Dancing Rune Weapon...
13105 if (GetEntry() == 27893)
13106 {
13107 if (Unit* owner = GetOwner())
13108 return owner->MeleeDamageBonusDone(victim, pdamage, attType, spellProto, damageSchoolMask) / 2;
13109 }
13110 }
13111
13112 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
13113
13114 // Done fixed damage bonus auras
13115 int32 DoneFlatBenefit = 0;
13116
13117 // ..done
13119 for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i)
13120 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13121 DoneFlatBenefit += (*i)->GetAmount();
13122
13123 // ..done
13124 // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage
13125
13126 // ..done (base at attack power for marked target and base at attack power for creature type)
13127 int32 APbonus = 0;
13128
13129 if (attType == RANGED_ATTACK)
13130 {
13131 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
13132
13133 // ..done (base at attack power and creature type)
13135 for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
13136 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13137 APbonus += (*i)->GetAmount();
13138 }
13139 else
13140 {
13141 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
13142
13143 // ..done (base at attack power and creature type)
13145 for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
13146 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13147 APbonus += (*i)->GetAmount();
13148 }
13149
13150 if (APbonus != 0) // Can be negative
13151 {
13152 bool normalized = false;
13153 if (spellProto)
13154 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
13155 if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
13156 {
13157 normalized = true;
13158 break;
13159 }
13160 DoneFlatBenefit += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
13161 }
13162
13163 // Done total percent damage auras
13164 float DoneTotalMod = 1.0f;
13165
13166 // mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
13167 if (!(damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL))
13168 {
13169 // Some spells don't benefit from pct done mods
13171 for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
13172 {
13173 if (!spellProto || (spellProto->ValidateAttribute6SpellDamageMods(this, *i, false) &&
13174 sScriptMgr->IsNeedModMeleeDamagePercent(this, *i, DoneTotalMod, spellProto)))
13175 {
13176 if (((*i)->GetMiscValue() & damageSchoolMask))
13177 {
13178 if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
13179 AddPct(DoneTotalMod, (*i)->GetAmount());
13180 else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
13181 AddPct(DoneTotalMod, (*i)->GetAmount());
13182 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
13183 AddPct(DoneTotalMod, (*i)->GetAmount());
13184 }
13185 }
13186 }
13187 }
13188
13190 for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
13191 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13192 if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13193 AddPct(DoneTotalMod, (*i)->GetAmount());
13194
13195 // bonus against aurastate
13197 for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
13198 if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
13199 if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13200 AddPct(DoneTotalMod, (*i)->GetAmount());
13201
13202 // done scripted mod (take it from owner)
13203 Unit* owner = GetOwner() ? GetOwner() : this;
13204 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
13205 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
13206 {
13207 if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13208 continue;
13209
13210 if (!(*i)->IsAffectedOnSpell(spellProto))
13211 continue;
13212
13213 switch ((*i)->GetMiscValue())
13214 {
13215 // Tundra Stalker
13216 // Merciless Combat
13217 case 7277:
13218 {
13219 // Merciless Combat
13220 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
13221 {
13222 if (!victim->HealthAbovePct(35))
13223 AddPct(DoneTotalMod, (*i)->GetAmount());
13224 }
13225 // Tundra Stalker
13226 else
13227 {
13228 // Frost Fever (target debuff)
13229 if (victim->HasAura(55095))
13230 AddPct(DoneTotalMod, (*i)->GetAmount());
13231 }
13232 break;
13233 }
13234 // Rage of Rivendare
13235 case 7293:
13236 {
13237 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
13238 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
13239 break;
13240 }
13241 // Marked for Death
13242 case 7598:
13243 case 7599:
13244 case 7600:
13245 case 7601:
13246 case 7602:
13247 {
13248 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
13249 AddPct(DoneTotalMod, (*i)->GetAmount());
13250 break;
13251 }
13252 // Dirty Deeds
13253 case 6427:
13254 case 6428:
13255 {
13256 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
13257 {
13258 // effect 0 has expected value but in negative state
13259 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
13260 AddPct(DoneTotalMod, bonus);
13261 }
13262 break;
13263 }
13264 }
13265 }
13266
13267 // Custom scripted damage
13268 if (spellProto)
13269 switch (spellProto->SpellFamilyName)
13270 {
13272 // Glacier Rot
13273 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
13275 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
13276 AddPct(DoneTotalMod, aurEff->GetAmount());
13277 break;
13278 }
13279
13280 // Some spells don't benefit from done mods
13281 if (spellProto)
13282 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
13283 {
13284 DoneFlatBenefit = 0;
13285 DoneTotalMod = 1.0f;
13286 }
13287
13288 float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
13289
13290 // apply spellmod to Done damage
13291 if (spellProto)
13292 if (Player* modOwner = GetSpellModOwner())
13293 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
13294
13295 // bonus result can be negative
13296 return uint32(std::max(tmpDamage, 0.0f));
13297}
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Definition SharedDefines.h:899
@ SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM
Definition SharedDefines.h:583
@ SPELL_ATTR3_IGNORE_CASTER_MODIFIERS
Definition SharedDefines.h:522
@ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS
Definition SpellAuraDefines.h:165
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS
Definition SpellAuraDefines.h:231
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS
Definition SpellAuraDefines.h:194
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE
Definition SpellAuraDefines.h:366
@ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
Definition SpellAuraDefines.h:122
@ SPELLMOD_DAMAGE
Definition SpellDefines.h:76
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition Unit.cpp:17241
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition Unit.h:1364

References AddPct(), AURA_STATE_HEALTHLESS_35_PERCENT, SpellInfo::Effects, GetAPMultiplier(), GetAuraEffect(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetOwner(), GetSpellModOwner(), GetTotalAuraModifier(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HealthAbovePct(), SpellInfo::Id, Object::IsCreature(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_DAMAGE, sScriptMgr, Object::ToPlayer(), and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeDamageBonusTaken()

uint32 Unit::MeleeDamageBonusTaken ( Unit attacker,
uint32  pdamage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
13300{
13301 if (pdamage == 0)
13302 return 0;
13303
13304 int32 TakenFlatBenefit = 0;
13305
13306 // ..taken
13308 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
13309 if ((*i)->GetMiscValue() & damageSchoolMask)
13310 TakenFlatBenefit += (*i)->GetAmount();
13311
13312 if (attType != RANGED_ATTACK)
13314 else
13316
13317 // Taken total percent damage auras
13318 float TakenTotalMod = 1.0f;
13319
13321
13322 // .. taken pct (special attacks)
13323 if (spellProto)
13324 {
13325 // From caster spells
13327 for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
13328 if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
13329 AddPct(TakenTotalMod, (*i)->GetAmount());
13330
13331 // Mod damage from spell mechanic
13332 uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
13333
13334 // Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
13335 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[0] & 0x00008800)
13336 mechanicMask |= (1 << MECHANIC_BLEED);
13337
13338 if (mechanicMask)
13339 {
13341 for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
13342 if (mechanicMask & uint32(1 << ((*i)->GetMiscValue())))
13343 AddPct(TakenTotalMod, (*i)->GetAmount());
13344 }
13345 }
13346
13347 TakenTotalMod = processDummyAuras(TakenTotalMod);
13348
13349 // .. taken pct: class scripts
13350 /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
13351 for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
13352 {
13353 switch ((*i)->GetMiscValue())
13354 {
13355 }
13356 }*/
13357
13358 if (attType != RANGED_ATTACK)
13359 {
13361 for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
13362 AddPct(TakenTotalMod, (*i)->GetAmount());
13363 }
13364 else
13365 {
13366 AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
13367 for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
13368 AddPct(TakenTotalMod, (*i)->GetAmount());
13369 }
13370
13371 // No positive taken bonus, custom attr
13372 if (spellProto)
13373 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
13374 {
13375 TakenFlatBenefit = 0;
13376 TakenTotalMod = 1.0f;
13377 }
13378
13379 // xinef: sanctified wrath talent
13380 if (TakenTotalMod < 1.0f && attacker->HasIgnoreTargetResistAura())
13381 {
13382 float ignoreModifier = 1.0f - TakenTotalMod;
13383 bool addModifier = false;
13385 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
13386 if ((*j)->GetMiscValue() & damageSchoolMask)
13387 {
13388 ApplyPct(ignoreModifier, (*j)->GetAmount());
13389 addModifier = true;
13390 }
13391
13392 if (addModifier)
13393 TakenTotalMod += ignoreModifier;
13394 }
13395
13396 float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
13397
13398 // bonus result can be negative
13399 return uint32(std::max(tmpDamage, 0.0f));
13400}
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN
Definition SpellAuraDefines.h:176
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition SpellAuraDefines.h:150
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN
Definition SpellAuraDefines.h:188
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT
Definition SpellAuraDefines.h:189
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition SpellAuraDefines.h:77
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition SpellAuraDefines.h:334
@ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
Definition SpellAuraDefines.h:318
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT
Definition SpellAuraDefines.h:177
@ SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS
Definition SpellInfo.h:197
float processDummyAuras(float TakenTotalMod) const
Definition Unit.cpp:11925
bool HasIgnoreTargetResistAura() const
Definition Unit.h:1739

References AddPct(), ApplyPct(), SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), Object::GetGUID(), GetTotalAuraModifier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasIgnoreTargetResistAura(), MECHANIC_BLEED, processDummyAuras(), RANGED_ATTACK, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeSpellHitResult()

SpellMissInfo Unit::MeleeSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3155{
3156 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3157 // resist and deflect chances
3158 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3159 return SPELL_MISS_NONE;
3160
3161 WeaponAttackType attType = BASE_ATTACK;
3162
3163 // Check damage class instead of attack type to correctly handle judgements
3164 // - they are meele, but can't be dodged/parried/deflected because of ranged dmg class
3165 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
3166 attType = RANGED_ATTACK;
3167
3168 int32 attackerWeaponSkill;
3169 // skill value for these spells (for example judgements) is 5* level
3170 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell())
3171 attackerWeaponSkill = GetLevel() * 5;
3172 // bonus from skills is 0.04% per skill Diff
3173 else
3174 attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
3175
3176 int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this));
3177
3178 uint32 roll = urand (0, 10000);
3179
3180 uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spellInfo->Id) * 100.0f);
3181 // Roll miss
3182 uint32 tmp = missChance;
3183 if (roll < tmp)
3184 return SPELL_MISS_MISS;
3185
3186 bool canDodge = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_DODGE);
3187 bool canParry = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_PARRY);
3188 bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED) && !spellInfo->HasAttribute(SPELL_ATTR0_CU_DIRECT_DAMAGE);
3189
3190 // Same spells cannot be parry/dodge
3191 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3192 return SPELL_MISS_NONE;
3193
3194 // Chance resist mechanic
3195 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3196 tmp += resist_chance;
3197 if (roll < tmp)
3198 return SPELL_MISS_RESIST;
3199
3200 // Ranged attacks can only miss, resist and deflect
3201 if (attType == RANGED_ATTACK)
3202 {
3203 // only if in front
3204 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasIgnoreHitDirectionAura()))
3205 {
3206 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3207 tmp += deflect_chance;
3208 if (roll < tmp)
3209 return SPELL_MISS_DEFLECT;
3210 }
3211
3212 canDodge = false;
3213 canParry = false;
3214 }
3215
3216 // Check for attack from behind
3217 // xinef: if from behind or spell requires cast from behind
3218 if (!victim->HasInArc(M_PI, this))
3219 {
3220 if (!victim->HasIgnoreHitDirectionAura() || spellInfo->HasAttribute(SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET))
3221 {
3222 // Can`t dodge from behind in PvP (but its possible in PvE)
3223 if (victim->IsPlayer())
3224 {
3225 canDodge = false;
3226 }
3227
3228 // Can`t parry or block
3229 canParry = false;
3230 canBlock = false;
3231 }
3232 }
3233
3234 // Check creatures flags_extra for disable parry
3235 if (victim->IsCreature())
3236 {
3237 uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
3238 // Xinef: no dodge flag
3239 if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE)
3240 canDodge = false;
3241 if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
3242 canParry = false;
3243 // Check creatures flags_extra for disable block
3244 if (flagEx & CREATURE_FLAG_EXTRA_NO_BLOCK)
3245 canBlock = false;
3246 }
3247 // Ignore combat result aura
3249 for (AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
3250 {
3251 if (!(*i)->IsAffectedOnSpell(spellInfo))
3252 continue;
3253 switch ((*i)->GetMiscValue())
3254 {
3255 case MELEE_HIT_DODGE:
3256 canDodge = false;
3257 break;
3258 case MELEE_HIT_BLOCK:
3259 canBlock = false;
3260 break;
3261 case MELEE_HIT_PARRY:
3262 canParry = false;
3263 break;
3264 default:
3265 LOG_DEBUG("entities.unit", "Spell {} SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state {}", (*i)->GetId(), (*i)->GetMiscValue());
3266 break;
3267 }
3268 }
3269
3270 if (canDodge)
3271 {
3272 // Roll dodge
3273 int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f) - skillDiff * 4;
3274 // Reduce enemy dodge chance by SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
3276 dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
3277 // Reduce dodge chance by attacker expertise rating
3278 if (IsPlayer())
3279 dodgeChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3280 else
3282
3283 // xinef: cant dodge while casting or while stunned
3284 if (dodgeChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3285 dodgeChance = 0;
3286
3287 tmp += dodgeChance;
3288 if (roll < tmp)
3289 return SPELL_MISS_DODGE;
3290 }
3291
3292 if (canParry)
3293 {
3294 // Roll parry
3295 int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4;
3296 // Reduce parry chance by attacker expertise rating
3297 if (IsPlayer())
3298 parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3299 else
3301
3302 // xinef: cant parry while casting or while stunned
3303 if (parryChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3304 parryChance = 0;
3305
3306 tmp += parryChance;
3307 if (roll < tmp)
3308 return SPELL_MISS_PARRY;
3309 }
3310
3311 if (canBlock)
3312 {
3313 int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4;
3314
3315 // xinef: cant block while casting or while stunned
3316 if (blockChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3317 blockChance = 0;
3318
3319 tmp += blockChance;
3320 if (roll < tmp)
3321 return SPELL_MISS_BLOCK;
3322 }
3323
3324 return SPELL_MISS_NONE;
3325}
@ CREATURE_FLAG_EXTRA_NO_PARRY
Definition CreatureData.h:47
@ CREATURE_FLAG_EXTRA_NO_DODGE
Definition CreatureData.h:68
@ SPELL_ATTR7_NO_ATTACK_PARRY
Definition SharedDefines.h:665
@ SPELL_ATTR7_NO_ATTACK_DODGE
Definition SharedDefines.h:664
@ SPELL_ATTR3_COMPLETELY_BLOCKED
Definition SharedDefines.h:496
@ SPELL_MISS_PARRY
Definition SharedDefines.h:1523
@ SPELL_MISS_DODGE
Definition SharedDefines.h:1522
@ SPELL_MISS_BLOCK
Definition SharedDefines.h:1524
@ SPELL_AURA_MOD_EXPERTISE
Definition SpellAuraDefines.h:303
@ SPELL_AURA_IGNORE_COMBAT_RESULT
Definition SpellAuraDefines.h:265
@ SPELL_AURA_MOD_ENEMY_DODGE
Definition SpellAuraDefines.h:314
@ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
Definition SpellAuraDefines.h:311
@ SPELL_ATTR0_CU_DIRECT_DAMAGE
Definition SpellInfo.h:184
@ SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET
Definition SpellInfo.h:193
float GetUnitDodgeChance() const
Definition Unit.cpp:3640
float GetTotalAuraMultiplier(AuraType auratype) const
Definition Unit.cpp:5947
float GetUnitParryChance() const
Definition Unit.cpp:3657
float MeleeSpellMissChance(Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
Definition Unit.cpp:19011

References BASE_ATTACK, CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, SpellInfo::DmgClass, CreatureTemplate::flags_extra, GetAuraEffectsByType(), Creature::GetCreatureTemplate(), GetLevel(), GetMaxSkillValueForLevel(), GetMechanicResistChance(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetUnitBlockChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, Object::IsCreature(), IsNonMeleeSpellCast(), Object::IsPlayer(), SpellInfo::IsRangedWeaponSpell(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_DODGE, MELEE_HIT_PARRY, MeleeSpellMissChance(), RANGED_ATTACK, SPELL_ATTR0_CU_DIRECT_DAMAGE, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET, SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR3_COMPLETELY_BLOCKED, SPELL_ATTR7_NO_ATTACK_DODGE, SPELL_ATTR7_NO_ATTACK_PARRY, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_COMBAT_RESULT, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, SPELL_DAMAGE_CLASS_RANGED, SPELL_MISS_BLOCK, SPELL_MISS_DEFLECT, SPELL_MISS_DODGE, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_RESIST, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONTROLLED, UNIT_STATE_STUNNED, urand(), and VICTIMSTATE_DODGE.

Referenced by SpellHitResult(), and SpellHitResult().

◆ MeleeSpellMissChance()

float Unit::MeleeSpellMissChance ( Unit const *  victim,
WeaponAttackType  attType,
int32  skillDiff,
uint32  spellId 
) const
19012{
19013 SpellInfo const* spellInfo = spellId ? sSpellMgr->GetSpellInfo(spellId) : nullptr;
19014 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
19015 {
19016 return 0.0f;
19017 }
19018
19019 //calculate miss chance
19020 float missChance = victim->GetUnitMissChance(attType);
19021
19022 // Check if dual wielding, add additional miss penalty - when mainhand has on next swing spell, offhand doesnt suffer penalty
19023 if (!spellId && (attType != RANGED_ATTACK) && HasOffhandWeaponForAttack() && (!m_currentSpells[CURRENT_MELEE_SPELL] || !m_currentSpells[CURRENT_MELEE_SPELL]->IsNextMeleeSwingSpell()))
19024 {
19025 missChance += 19;
19026 }
19027
19028 // bonus from skills is 0.04%
19029 //miss_chance -= skillDiff * 0.04f;
19030 int32 diff = -skillDiff;
19031 if (victim->IsPlayer())
19032 missChance += diff > 0 ? diff * 0.04f : diff * 0.02f;
19033 else
19034 missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
19035
19036 // Calculate hit chance
19037 float hitChance = 100.0f;
19038
19039 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
19040 if (spellId)
19041 {
19042 if (Player* modOwner = GetSpellModOwner())
19043 modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance);
19044 }
19045
19046 missChance -= hitChance - 100.0f;
19047
19048 if (attType == RANGED_ATTACK)
19049 missChance -= m_modRangedHitChance;
19050 else
19051 missChance -= m_modMeleeHitChance;
19052
19053 // Limit miss chance from 0 to 60%
19054 if (missChance < 0.0f)
19055 return 0.0f;
19056 if (missChance > 60.0f)
19057 return 60.0f;
19058 return missChance;
19059}

References CURRENT_MELEE_SPELL, GetSpellModOwner(), GetUnitMissChance(), SpellInfo::HasAttribute(), HasOffhandWeaponForAttack(), Object::IsPlayer(), m_currentSpells, m_modMeleeHitChance, m_modRangedHitChance, RANGED_ATTACK, SPELL_ATTR7_NO_ATTACK_MISS, SPELLMOD_RESIST_MISS_CHANCE, and sSpellMgr.

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ ModifyAuraState()

void Unit::ModifyAuraState ( AuraStateType  flag,
bool  apply 
)
10521{
10522 if (apply)
10523 {
10524 if (!HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
10525 {
10526 SetFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10527 Unit::AuraMap& tAuras = GetOwnedAuras();
10528 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
10529 {
10530 if ((*itr).second->IsRemoved())
10531 continue;
10532
10533 if ((*itr).second->GetSpellInfo()->CasterAuraState == flag )
10534 if (AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()))
10535 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true);
10536 }
10537 }
10538 }
10539 else
10540 {
10541 if (HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
10542 {
10543 RemoveFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10544
10545 if (flag != AURA_STATE_ENRAGE) // enrage aura state triggering continues auras
10546 {
10547 Unit::AuraMap& tAuras = GetOwnedAuras();
10548 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
10549 {
10550 if ((*itr).second->GetSpellInfo()->CasterAuraState == flag )
10551 if (AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()))
10552 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false);
10553 }
10554 }
10555 }
10556 }
10557}
@ AURA_STATE_ENRAGE
Definition SharedDefines.h:1309
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:845
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:860
std::multimap< uint32, Aura * > AuraMap
Definition Unit.h:641
AuraMap & GetOwnedAuras()
Definition Unit.h:1300

References AURA_EFFECT_HANDLE_REAL, AURA_STATE_ENRAGE, Object::GetGUID(), GetOwnedAuras(), Object::HasFlag(), Object::RemoveFlag(), Object::SetFlag(), and UNIT_FIELD_AURASTATE.

Referenced by _ApplyAura(), _UnapplyAura(), ClearAllReactives(), Spell::finish(), debug_commandscript::HandleDebugSetAuraStateCommand(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), ProcDamageAndSpellFor(), Update(), and UpdateReactives().

◆ ModifyHealth()

int32 Unit::ModifyHealth ( int32  val)
14115{
14116 int32 gain = 0;
14117
14118 if (dVal == 0)
14119 return 0;
14120
14121 int32 curHealth = (int32)GetHealth();
14122
14123 int32 val = dVal + curHealth;
14124 if (val <= 0)
14125 {
14126 SetHealth(0);
14127 return -curHealth;
14128 }
14129
14130 int32 maxHealth = (int32)GetMaxHealth();
14131
14132 if (val < maxHealth)
14133 {
14134 SetHealth(val);
14135 gain = val - curHealth;
14136 }
14137 else if (curHealth != maxHealth)
14138 {
14139 SetHealth(maxHealth);
14140 gain = maxHealth - curHealth;
14141 }
14142
14143 return gain;
14144}

References GetHealth(), GetMaxHealth(), and SetHealth().

Referenced by DealDamage(), DealHeal(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), boss_hadronox::boss_hadronoxAI::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::RegenerateHealth(), Player::RegenerateHealth(), npc_injured_patient::npc_injured_patientAI::Reset(), Spell::TakePower(), Aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ ModifyPower()

int32 Unit::ModifyPower ( Powers  power,
int32  val,
bool  withPowerUpdate = true 
)
14173{
14174 if (dVal == 0)
14175 return 0;
14176
14177 int32 gain = 0;
14178
14179 int32 curPower = (int32)GetPower(power);
14180
14181 int32 val = dVal + curPower;
14182 if (val <= 0)
14183 {
14184 SetPower(power, 0, withPowerUpdate);
14185 return -curPower;
14186 }
14187
14188 int32 maxPower = (int32)GetMaxPower(power);
14189
14190 if (val < maxPower)
14191 {
14192 SetPower(power, val, withPowerUpdate);
14193 gain = val - curPower;
14194 }
14195 else if (curPower != maxPower)
14196 {
14197 SetPower(power, maxPower, withPowerUpdate);
14198 gain = maxPower - curPower;
14199 }
14200
14201 if (GetAI())
14202 {
14203 GetAI()->OnPowerUpdate(power, gain, dVal, curPower);
14204 }
14205
14206 return gain;
14207}
virtual void OnPowerUpdate(Powers, int32, int32, uint32)
Called when the creature power updates.
Definition UnitAI.h:375
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15589

References GetAI(), GetMaxPower(), GetPower(), UnitAI::OnPowerUpdate(), and SetPower().

Referenced by CalcAbsorbResist(), spell_igb_cannon_blast::CalculatePower(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), EnergizeBySpell(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_kelthuzad_detonate_mana_aura::HandleScript(), boss_pathaleon_the_calculator::JustEngagedWith(), boss_curator::JustEngagedWith(), Pet::LoseHappiness(), ModifyPowerPct(), Creature::Regenerate(), RewardRage(), Pet::setDeathState(), Spell::TakePower(), Spell::TakeRunePower(), Aura::Update(), and boss_faction_championsAI::UpdateAI().

◆ ModifyPowerPct()

int32 Unit::ModifyPowerPct ( Powers  power,
float  pct,
bool  apply = true 
)
14211{
14212 float amount = (float)GetMaxPower(power);
14213 ApplyPercentModFloatVar(amount, pct, apply);
14214
14215 return ModifyPower(power, (int32)amount - (int32)GetMaxPower(power));
14216}

References ApplyPercentModFloatVar(), GetMaxPower(), and ModifyPower().

Referenced by AuraEffect::HandleAuraModIncreaseEnergyPercent().

◆ ModifyRedirectThreat()

void Unit::ModifyRedirectThreat ( int32  amount)
inline
void ModifyThreatPct(int32 amount)
Definition ThreatMgr.h:307

References _redirectThreatInfo, and RedirectThreatInfo::ModifyThreatPct().

Referenced by spell_warr_vigilance::HandleAfterApply().

◆ ModSpellCastTime()

void Unit::ModSpellCastTime ( SpellInfo const *  spellProto,
int32 castTime,
Spell spell = nullptr 
)
Todo:
:(MadAgos) Eventually check and delete the bool argument
14997{
14998 if (!spellInfo || castTime < 0)
14999 return;
15000
15001 if (spellInfo->IsChanneled() && spellInfo->HasAura(SPELL_AURA_MOUNTED))
15002 return;
15003
15004 // called from caster
15005 if (Player* modOwner = GetSpellModOwner())
15007 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell, bool(modOwner != this && !IsPet()));
15008
15009 switch (spellInfo->DmgClass)
15010 {
15012 if (spellInfo->AttributesEx5 & SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC) // required double check
15013 castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
15014 else if (spellInfo->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
15015 castTime = 500;
15016 break;
15018 break; // no known cases
15020 castTime = CanInstantCast() ? 0 : int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
15021 break;
15023 castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
15024 break;
15025 default:
15026 break;
15027 }
15028}
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition SharedDefines.h:580
@ SPELLMOD_CASTING_TIME
Definition SpellDefines.h:86
bool CanInstantCast() const
Definition Unit.h:1509

References SpellInfo::AttributesEx5, CanInstantCast(), SpellInfo::DmgClass, Object::GetFloatValue(), GetSpellModOwner(), SpellInfo::HasAura(), HasAura(), SpellInfo::Id, SpellInfo::IsChanneled(), IsPet(), m_modAttackSpeedPct, RANGED_ATTACK, SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_MOUNTED, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLMOD_CASTING_TIME, SpellInfo::SpellVisual, and UNIT_MOD_CAST_SPEED.

Referenced by SpellInfo::CalcCastTime().

◆ ModSpellDuration()

int32 Unit::ModSpellDuration ( SpellInfo const *  spellProto,
Unit const *  target,
int32  duration,
bool  positive,
uint32  effectMask 
)
14897{
14898 // don't mod permanent auras duration
14899 if (duration < 0)
14900 return duration;
14901
14902 // some auras are not affected by duration modifiers
14903 if (spellProto->HasAttribute(SPELL_ATTR7_NO_TARGET_DURATION_MOD))
14904 return duration;
14905
14906 // cut duration only of negative effects
14907 // xinef: also calculate self casts, spell can be reflected for example
14908 if (!positive)
14909 {
14910 int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask);
14911
14912 int32 durationMod;
14913 int32 durationMod_always = 0;
14914 int32 durationMod_not_stack = 0;
14915
14916 for (uint8 i = 1; i <= MECHANIC_ENRAGED; ++i)
14917 {
14918 if (!(mechanic & 1 << i))
14919 continue;
14920
14921 // Xinef: spells affecting movement imparing effects should not reduce duration if disoriented mechanic is present
14922 if (i == MECHANIC_SNARE && (mechanic & (1 << MECHANIC_DISORIENTED)))
14923 continue;
14924
14925 // Find total mod value (negative bonus)
14926 int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i);
14927 // Find max mod (negative bonus)
14928 int32 new_durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, i);
14929 // Check if mods applied before were weaker
14930 if (new_durationMod_always < durationMod_always)
14931 durationMod_always = new_durationMod_always;
14932 if (new_durationMod_not_stack < durationMod_not_stack)
14933 durationMod_not_stack = new_durationMod_not_stack;
14934 }
14935
14936 // Select strongest negative mod
14937 if (durationMod_always > durationMod_not_stack)
14938 durationMod = durationMod_not_stack;
14939 else
14940 durationMod = durationMod_always;
14941
14942 if (durationMod != 0)
14943 AddPct(duration, durationMod);
14944
14945 // there are only negative mods currently
14946 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
14947 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
14948
14949 durationMod = 0;
14950 if (durationMod_always > durationMod_not_stack)
14951 durationMod += durationMod_not_stack;
14952 else
14953 durationMod += durationMod_always;
14954
14955 if (durationMod != 0)
14956 AddPct(duration, durationMod);
14957 }
14958 else
14959 {
14960 // else positive mods here, there are no currently
14961 // when there will be, change GetTotalAuraModifierByMiscValue to GetTotalPositiveAuraModifierByMiscValue
14962 }
14963
14964 // Glyphs which increase duration of selfcasted buffs
14965 if (target == this)
14966 {
14967 switch (spellProto->SpellFamilyName)
14968 {
14969 case SPELLFAMILY_DRUID:
14970 if (spellProto->SpellFamilyFlags[0] & 0x100)
14971 {
14972 // Glyph of Thorns
14973 if (AuraEffect* aurEff = GetAuraEffect(57862, 0))
14974 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14975 }
14976 break;
14978 if ((spellProto->SpellFamilyFlags[0] & 0x00000002) && spellProto->SpellIconID == 298)
14979 {
14980 // Glyph of Blessing of Might
14981 if (AuraEffect* aurEff = GetAuraEffect(57958, 0))
14982 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14983 }
14984 else if ((spellProto->SpellFamilyFlags[0] & 0x00010000) && spellProto->SpellIconID == 306)
14985 {
14986 // Glyph of Blessing of Wisdom
14987 if (AuraEffect* aurEff = GetAuraEffect(57979, 0))
14988 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14989 }
14990 break;
14991 }
14992 }
14993 return std::max(duration, 0);
14994}
constexpr auto MINUTE
Definition Common.h:47
@ SPELL_ATTR7_NO_TARGET_DURATION_MOD
Definition SharedDefines.h:642
@ MECHANIC_ENRAGED
Definition SharedDefines.h:1356
@ MECHANIC_DISORIENTED
Definition SharedDefines.h:1327
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK
Definition SpellAuraDefines.h:309
@ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK
Definition SpellAuraDefines.h:297
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
Definition SpellAuraDefines.h:308
@ SPELL_AURA_MECHANIC_DURATION_MOD
Definition SpellAuraDefines.h:295

References AddPct(), SpellInfo::Dispel, GetAuraEffect(), GetMaxNegativeAuraModifierByMiscValue(), SpellInfo::GetSpellMechanicMaskByEffectMask(), GetTotalAuraModifierByMiscValue(), SpellInfo::HasAttribute(), IN_MILLISECONDS, MECHANIC_DISORIENTED, MECHANIC_ENRAGED, MECHANIC_SNARE, MINUTE, SPELL_ATTR7_NO_TARGET_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, SPELLFAMILY_DRUID, SPELLFAMILY_PALADIN, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

Referenced by Spell::DoSpellHitOnUnit(), and Spell::EffectInterruptCast().

◆ MonsterMoveWithSpeed()

◆ Mount()

void Unit::Mount ( uint32  mount,
uint32  vehicleId = 0,
uint32  creatureEntry = 0 
)
13489{
13490 if (mount)
13492
13494
13495 if (Player* player = ToPlayer())
13496 {
13497 sScriptMgr->AnticheatSetUnderACKmount(player);
13498
13499 // mount as a vehicle
13500 if (VehicleId)
13501 {
13502 if (CreateVehicleKit(VehicleId, creatureEntry))
13503 {
13504 GetVehicleKit()->Reset();
13505
13506 // Send others that we now have a vehicle
13508 data << GetPackGUID();
13509 data << uint32(VehicleId);
13510 SendMessageToSet(&data, true);
13511
13513 player->GetSession()->SendPacket(&data);
13514
13515 // mounts can also have accessories
13517 }
13518 }
13519
13520 // unsummon pet
13521 Pet* pet = player->GetPet();
13522 if (pet)
13523 {
13525 // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
13526 if (bg && bg->isArena())
13528 else
13529 player->UnsummonPetTemporaryIfAny();
13530 }
13531
13532 // xinef: if we have charmed npc, stun him also
13533 if (Unit* charm = player->GetCharm())
13534 if (charm->IsCreature())
13535 charm->SetUnitFlag(UNIT_FLAG_STUNNED);
13536
13537 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
13538 data << GetPackGUID();
13539 data << uint32(GameTime::GetGameTime().count()); // Packet counter
13540 data << player->GetCollisionHeight();
13541 player->GetSession()->SendPacket(&data);
13542 }
13543
13545}
@ AURA_INTERRUPT_FLAG_MOUNT
Definition SpellDefines.h:60
bool isArena() const
Definition Battleground.h:413
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition Unit.cpp:18738
void Reset(bool evading=false)
Definition Vehicle.cpp:119
void InstallAllAccessories(bool evading)
Definition Vehicle.cpp:86

References AURA_INTERRUPT_FLAG_MOUNT, CreateVehicleKit(), Player::GetBattleground(), GetCharm(), GameTime::GetGameTime(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), Vehicle::InstallAllAccessories(), Battleground::isArena(), RemoveAurasWithInterruptFlags(), Vehicle::Reset(), WorldObject::SendMessageToSet(), SetUInt32Value(), SetUnitFlag(), SMSG_MOVE_SET_COLLISION_HGT, SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, and UNIT_FLAG_STUNNED.

Referenced by AuraEffect::HandleAuraMounted(), spell_mount_check_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyMountCommand(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::InitializeAI(), boss_captain_skarloc::InitializeAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::JustRespawned(), Creature::LoadCreaturesAddon(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), npc_scarlet_courier::npc_scarlet_courierAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), WorldSession::SendDoFlight(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ NearTeleportTo() [1/2]

void Unit::NearTeleportTo ( float  x,
float  y,
float  z,
float  orientation,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
20008{
20009 DisableSpline();
20010 if (IsPlayer())
20011 ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | (removeTransport ? 0 : TELE_TO_NOT_LEAVE_TRANSPORT) | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0) | (vehicleTeleport ? TELE_TO_NOT_LEAVE_VEHICLE : 0) | (withPet ? TELE_TO_WITH_PET : 0));
20012 else
20013 {
20014 Position pos = {x, y, z, orientation};
20015 SendTeleportPacket(pos);
20016 UpdatePosition(x, y, z, orientation, true);
20019 }
20020}
@ TELE_TO_WITH_PET
Definition Player.h:832
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition Player.h:831
@ TELE_TO_SPELL
Definition Player.h:830
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:828
@ TELE_TO_NOT_UNSUMMON_PET
Definition Player.h:829
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:827
void ReinitializeMovement()
Definition MotionMaster.cpp:904
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1334
void SendTeleportPacket(Position &pos)
Definition Unit.cpp:20029
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition Unit.cpp:19153
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:20048

References DisableSpline(), WorldLocation::GetMapId(), GetMotionMaster(), Object::IsPlayer(), MotionMaster::ReinitializeMovement(), SendTeleportPacket(), TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, Player::TeleportTo(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdatePosition().

◆ NearTeleportTo() [2/2]

void Unit::NearTeleportTo ( Position pos,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
20003{
20004 NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), casting, vehicleTeleport, withPet, removeTransport);
20005}
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:20002

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and NearTeleportTo().

Referenced by boss_viscidus::DamageTaken(), npc_madrigosa::DoAction(), npc_akama_illidan::DoAction(), Spell::EffectLeap(), Spell::EffectResurrectPet(), Spell::EffectStuck(), Spell::EffectSummonPet(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), npc_giant_claw_tentacle::Emerge(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), BattlegroundBE::HandleAreaTrigger(), BattlegroundDS::HandleAreaTrigger(), BattlegroundNA::HandleAreaTrigger(), BattlegroundRL::HandleAreaTrigger(), BattlegroundRV::HandleAreaTrigger(), spell_moroes_vanish::HandleDummy(), spell_class_call_handler::HandleOnHitRogue(), npc_echo_of_medivh::HandlePieceJustDied(), BattlegroundBE::HandlePlayerUnderMap(), BattlegroundDS::HandlePlayerUnderMap(), BattlegroundNA::HandlePlayerUnderMap(), BattlegroundRL::HandlePlayerUnderMap(), BattlegroundRV::HandlePlayerUnderMap(), npc_pet_mage_mirror_image::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_grandmaster_vorpil::JustEngagedWith(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), NearTeleportTo(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_chesspiece::OnCharmed(), npc_vh_sinclari::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), npc_chesspiece::Reset(), boss_gothik::boss_gothikAI::Reset(), Map::ScriptsProcess(), npc_midsummer_torch_target::SelectPosition(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), npc_pos_leader_second::npc_pos_leader_secondAI::SpellHitTarget(), boss_cyanigosa::boss_cyanigosaAI::SpellHitTarget(), BattlegroundRV::TeleportUnitToNewZ(), Vehicle::TeleportVehicle(), npc_doomfire_spirit::TryTeleportInDirection(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_magus_telestra::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), and npc_minigob_manabonk::UpdateAI().

◆ OutDebugInfo()

void Unit::OutDebugInfo ( ) const
20258{
20259 LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
20260 LOG_INFO("entities.unit", "GUID {}, name {}", GetGUID().ToString(), GetName());
20261 LOG_INFO("entities.unit", "OwnerGUID {}, MinionGUID {}, CharmerGUID {}, CharmedGUID {}",
20263 LOG_INFO("entities.unit", "In world {}, unit type mask {}", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
20264 if (IsInWorld())
20265 LOG_INFO("entities.unit", "Mapid {}", GetMapId());
20266
20267 LOG_INFO("entities.unit", "Summon Slot: ");
20268 for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
20269 LOG_INFO("entities.unit", "{}, ", m_SummonSlot[i].ToString());
20270 LOG_INFO("server.loading", " ");
20271
20272 LOG_INFO("entities.unit", "Controlled List: ");
20273 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
20274 LOG_INFO("entities.unit", "{}, ", (*itr)->GetGUID().ToString());
20275 LOG_INFO("server.loading", " ");
20276
20277 LOG_INFO("entities.unit", "Aura List: ");
20278 for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
20279 LOG_INFO("entities.unit", "{}, ", itr->first);
20280 LOG_INFO("server.loading", " ");
20281
20282 if (IsVehicle())
20283 {
20284 LOG_INFO("entities.unit", "Passenger List: ");
20285 for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
20286 if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
20287 LOG_INFO("entities.unit", "{}, ", passenger->GetGUID().ToString());
20288 LOG_INFO("server.loading", " ");
20289 }
20290
20291 if (GetVehicle())
20292 LOG_INFO("entities.unit", "On vehicle {}.", GetVehicleBase()->GetEntry());
20293}
Seats
Definition boss_flame_leviathan.cpp:167
SeatMap Seats
Definition Vehicle.h:56

References GetCharmerGUID(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldLocation::GetMapId(), GetMinionGUID(), WorldObject::GetName(), GetOwnerGUID(), ObjectAccessor::GetUnit(), GetVehicle(), GetVehicleBase(), GetVehicleKit(), Object::IsInWorld(), IsVehicle(), LOG_ERROR, LOG_INFO, m_appliedAuras, m_Controlled, m_SummonSlot, m_unitTypeMask, MAX_SUMMON_SLOT, Vehicle::Seats, and Position::ToString().

Referenced by SetMinion().

◆ PatchValuesUpdate()

void Unit::PatchValuesUpdate ( ByteBuffer valuesUpdateBuf,
BuildValuesCachePosPointers posPointers,
Player target 
)
private
20870{
20871 Creature const* creature = ToCreature();
20872
20873 // UNIT_NPC_FLAGS
20874 if (creature && posPointers.UnitNPCFlagsPos >= 0)
20875 {
20876 uint32 appendValue = m_uint32Values[UNIT_NPC_FLAGS];
20877
20878 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && appendValue & UNIT_NPC_FLAG_FLIGHTMASTER)
20879 appendValue |= UNIT_NPC_FLAG_GOSSIP; // flight masters need NPC gossip flag to show instant flight toggle option
20880
20881 if (!target->CanSeeSpellClickOn(creature))
20882 appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
20883
20884 if (!target->CanSeeVendor(creature))
20885 appendValue &= ~UNIT_NPC_FLAG_VENDOR_MASK;
20886
20887 if (!creature->IsValidTrainerForPlayer(target, &appendValue))
20888 appendValue &= ~UNIT_NPC_FLAG_TRAINER;
20889
20890 valuesUpdateBuf.put(posPointers.UnitNPCFlagsPos, appendValue);
20891 }
20892
20893 // UNIT_FIELD_AURASTATE
20894 if (posPointers.UnitFieldAuraStatePos >= 0)
20895 valuesUpdateBuf.put(posPointers.UnitFieldAuraStatePos, uint32(BuildAuraStateUpdateForTarget(target)));
20896
20897 // UNIT_FIELD_FLAGS
20898 if (posPointers.UnitFieldFlagsPos >= 0)
20899 {
20900 uint32 appendValue = m_uint32Values[UNIT_FIELD_FLAGS];
20901 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
20902 appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
20903
20904 valuesUpdateBuf.put(posPointers.UnitFieldFlagsPos, appendValue);
20905 }
20906
20907 // UNIT_FIELD_DISPLAYID
20908 // Use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures.
20909 if (posPointers.UnitFieldDisplayPos >= 0)
20910 {
20912 if (creature)
20913 {
20914 CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
20915
20916 // this also applies for transform auras
20917 if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(getTransForm()))
20918 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
20919 if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
20920 if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
20921 {
20922 cinfo = transformInfo;
20923 break;
20924 }
20925
20927 {
20928 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
20929 {
20930 displayId = cinfo->GetFirstVisibleModel()->CreatureDisplayID;
20931 }
20932 else
20933 {
20934 displayId = cinfo->GetFirstInvisibleModel()->CreatureDisplayID;
20935 }
20936 }
20937 }
20938
20939 valuesUpdateBuf.put(posPointers.UnitFieldDisplayPos, uint32(displayId));
20940 }
20941
20942 // UNIT_DYNAMIC_FLAGS
20943 // Hide lootable animation for unallowed players.
20944 if (posPointers.UnitDynamicFlagsPos >= 0)
20945 {
20947
20948 if (creature)
20949 {
20950 if (creature->hasLootRecipient())
20951 {
20952 dynamicFlags |= UNIT_DYNFLAG_TAPPED;
20953 if (creature->isTappedBy(target))
20954 dynamicFlags |= UNIT_DYNFLAG_TAPPED_BY_PLAYER;
20955 }
20956
20957 if (!target->isAllowedToLoot(creature))
20958 dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
20959 }
20960
20961 // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
20962 if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
20964 dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
20965
20966 valuesUpdateBuf.put(posPointers.UnitDynamicFlagsPos, dynamicFlags);
20967 }
20968
20969 // UNIT_FIELD_BYTES_2
20970 if (posPointers.UnitFieldBytes2Pos >= 0)
20971 {
20972 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
20973 {
20975 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
20976 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
20977 // Allow targetting opposite faction in party when enabled in config
20978 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8))); // this flag is at uint8 offset 1 !!
20979 }// pussywizard / Callmephil
20980 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
20981 (this->IsPlayer() || this->IsCreature() || this->IsDynamicObject()))
20982 {
20983 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & 0xFFFFF2FF)); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
20984 }
20985 }
20986
20987 // UNIT_FIELD_FACTIONTEMPLATE
20988 if (posPointers.UnitFieldFactionTemplatePos >= 0)
20989 {
20990 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
20991 {
20993 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
20994 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
20995 // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
20996 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
20997 }// pussywizard / Callmephil
20998 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
20999 (this->IsPlayer() || this->IsCreature() || this->IsDynamicObject()))
21000 {
21001 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
21002 }
21003 }
21004
21005 sScriptMgr->OnPatchValuesUpdate(this, valuesUpdateBuf, posPointers, target);
21006}
@ CREATURE_FLAG_EXTRA_TRIGGER
Definition CreatureData.h:52
@ CONFIG_INSTANT_TAXI
Definition IWorld.h:383
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition IWorld.h:75
@ UNIT_DYNFLAG_TRACK_UNIT
Definition SharedDefines.h:3122
void put(std::size_t pos, T value)
Definition ByteBuffer.h:137
bool IsValidTrainerForPlayer(Player *player, uint32 *npcFlags=nullptr) const
Definition Creature.cpp:1265
bool isTappedBy(Player const *player) const
Definition Creature.cpp:1381
bool isAllowedToLoot(Creature const *creature)
Definition PlayerStorage.cpp:5620
bool CanSeeVendor(Creature const *creature) const
Definition Player.cpp:14334
bool IsSpectator() const
Definition Player.h:2579
bool CanSeeSpellClickOn(Creature const *creature) const
Definition Player.cpp:14311
uint32 BuildAuraStateUpdateForTarget(Unit *target) const
Definition Unit.cpp:10559
bool IsGMAccount() const
Definition WorldSession.cpp:179
int32 UnitFieldFlagsPos
Definition UnitUtils.h:99
int32 UnitFieldDisplayPos
Definition UnitUtils.h:100
int32 UnitDynamicFlagsPos
Definition UnitUtils.h:101
int32 UnitFieldAuraStatePos
Definition UnitUtils.h:98
int32 UnitFieldFactionTemplatePos
Definition UnitUtils.h:103
int32 UnitFieldBytes2Pos
Definition UnitUtils.h:102
int32 UnitNPCFlagsPos
Definition UnitUtils.h:97
uint32 CreatureDisplayID
Definition CreatureData.h:179
CreatureModel const * GetFirstInvisibleModel() const
Definition Creature.cpp:161
CreatureModel const * GetFirstVisibleModel() const
Definition Creature.cpp:171

References BuildAuraStateUpdateForTarget(), Player::CanSeeSpellClickOn(), Player::CanSeeVendor(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, CONFIG_INSTANT_TAXI, CREATURE_FLAG_EXTRA_TRIGGER, CreatureModel::CreatureDisplayID, WorldObject::FindMap(), CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetFaction(), GetFactionTemplateEntry(), CreatureTemplate::GetFirstInvisibleModel(), CreatureTemplate::GetFirstVisibleModel(), Object::GetGUID(), Player::GetSession(), getTransForm(), HasAuraTypeWithCaster(), Creature::hasLootRecipient(), Player::isAllowedToLoot(), Map::IsBattleArena(), IsControlledByPlayer(), FactionTemplateEntry::IsFriendlyTo(), Player::IsGameMaster(), WorldSession::IsGMAccount(), IsInRaidWith(), Player::IsSpectator(), Creature::isTappedBy(), Creature::IsValidTrainerForPlayer(), Object::m_uint32Values, MAX_SPELL_EFFECTS, ByteBuffer::put(), sObjectMgr, SPELL_AURA_MOD_STALKED, SPELL_AURA_TRANSFORM, sScriptMgr, sSpellMgr, sWorld, Object::ToCreature(), UNIT_BYTE2_FLAG_SANCTUARY, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_DYNFLAG_TRACK_UNIT, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, and BuildValuesCachePosPointers::UnitNPCFlagsPos.

Referenced by BuildValuesUpdate().

◆ PauseMovement()

void Unit::PauseMovement ( uint32  timer = 0,
uint8  slot = 0 
)
virtual

Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.

16693{
16694 if (slot >= MAX_MOTION_SLOT)
16695 return;
16696
16697 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
16698 movementGenerator->Pause(timer);
16699
16700 StopMoving();
16701}
@ MAX_MOTION_SLOT
Definition MotionMaster.h:66
Definition MovementGenerator.h:28
void StopMoving()
Definition Unit.cpp:16673

References GetMotionMaster(), MAX_MOTION_SLOT, and StopMoving().

Referenced by WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::SendListInventory(), and boss_shade_of_aran::SetGUID().

◆ PetSpellFail()

void Unit::PetSpellFail ( SpellInfo const *  spellInfo,
Unit target,
uint32  result 
)
20368{
20369 CharmInfo* charmInfo = GetCharmInfo();
20370 if (!charmInfo || !IsCreature())
20371 return;
20372
20374 {
20375 if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE))
20376 if (Unit* owner = GetOwner())
20377 {
20378 if (spellInfo->IsPositive() && IsFriendlyTo(target))
20379 {
20380 AttackStop();
20381 charmInfo->SetIsAtStay(false);
20382 charmInfo->SetIsCommandAttack(true);
20383 charmInfo->SetIsReturning(false);
20384 charmInfo->SetIsFollowing(false);
20385
20386 GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI);
20387 }
20388 else if (owner->IsValidAttackTarget(target))
20389 {
20390 AttackStop();
20391 charmInfo->SetIsAtStay(false);
20392 charmInfo->SetIsCommandAttack(true);
20393 charmInfo->SetIsReturning(false);
20394 charmInfo->SetIsFollowing(false);
20395
20396 if (!ToCreature()->HasReactState(REACT_PASSIVE))
20397 ToCreature()->AI()->AttackStart(target);
20398 else
20399 GetMotionMaster()->MoveChase(target);
20400 }
20401 }
20402
20403 // can be extended in future
20404 if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE)
20405 {
20406 charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id);
20407 charmInfo->SetForcedTargetGUID(target->GetGUID());
20408 }
20409 else
20410 {
20411 charmInfo->SetForcedSpell(0);
20413 }
20414 }
20415}
#define PET_FOLLOW_DIST
Definition PetDefines.h:202
@ SPELL_FAILED_OUT_OF_RANGE
Definition SharedDefines.h:1046
@ SPELL_FAILED_LINE_OF_SIGHT
Definition SharedDefines.h:996
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:313
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:409
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:27
bool IsPathfindingEnabled(const Map *map)
Definition DisableMgr.cpp:412
void SetIsAtStay(bool val)
Definition CharmInfo.cpp:365
void SetIsFollowing(bool val)
Definition CharmInfo.cpp:375
void SetIsReturning(bool val)
Definition CharmInfo.cpp:385
void SetForcedSpell(uint32 id)
Definition CharmInfo.h:177
void SetForcedTargetGUID(ObjectGuid guid=ObjectGuid::Empty)
Definition CharmInfo.h:179
void SetIsCommandAttack(bool val)
Definition CharmInfo.cpp:303

References Creature::AI(), UnitAI::AttackStart(), AttackStop(), ObjectGuid::Empty, GetCharmInfo(), Object::GetGUID(), WorldObject::GetMap(), GetMotionMaster(), GetOwner(), SpellInfo::Id, Object::IsCreature(), IsFriendlyTo(), DisableMgr::IsPathfindingEnabled(), SpellInfo::IsPositive(), MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, rand_norm(), REACT_PASSIVE, CharmInfo::SetForcedSpell(), CharmInfo::SetForcedTargetGUID(), CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), CharmInfo::SetIsFollowing(), CharmInfo::SetIsReturning(), SPELL_FAILED_LINE_OF_SIGHT, SPELL_FAILED_OUT_OF_RANGE, and Object::ToCreature().

Referenced by WorldSession::HandlePetActionHelper(), and WorldSession::HandlePetCastSpellOpcode().

◆ ProcDamageAndSpell()

void Unit::ProcDamageAndSpell ( Unit actor,
Unit victim,
uint32  procAttacker,
uint32  procVictim,
uint32  procEx,
uint32  amount,
WeaponAttackType  attType = BASE_ATTACK,
SpellInfo const *  procSpellInfo = nullptr,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
static
6402{
6403 // Not much to do if no flags are set.
6404 if (procAttacker && actor)
6405 actor->ProcDamageAndSpellFor(false, victim, procAttacker, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6406 // Now go on with a victim's events'n'auras
6407 // Not much to do if no flags are set or there is no victim
6408 if (victim && victim->IsAlive() && procVictim)
6409 victim->ProcDamageAndSpellFor(true, actor, procVictim, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6410}

References IsAlive(), and ProcDamageAndSpellFor().

Referenced by Spell::_cast(), Spell::_handle_finish_phase(), AttackerStateUpdate(), Spell::DoAllEffectOnTarget(), ReflectEvent::Execute(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and Kill().

◆ ProcDamageAndSpellFor()

void Unit::ProcDamageAndSpellFor ( bool  isVictim,
Unit target,
uint32  procFlag,
uint32  procExtra,
WeaponAttackType  attType,
SpellInfo const *  procSpellInfo,
uint32  damage,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
16078{
16079 // Player is loaded now - do not allow passive spell casts to proc
16080 if (IsPlayer() && ToPlayer()->GetSession()->PlayerLoading())
16081 return;
16082 // For melee/ranged based attack need update skills and set some Aura states if victim present
16083 if (procFlag & MELEE_BASED_TRIGGER_MASK && target && procPhase == PROC_SPELL_PHASE_HIT)
16084 {
16085 // Xinef: Shaman in ghost wolf form cant proc anything melee based
16086 if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF)
16087 return;
16088
16089 // Update skills here for players
16090 // only when you are not fighting other players or their pets/totems (pvp)
16091 if (IsPlayer() && !target->IsCharmedOwnedByPlayerOrPlayer())
16092 {
16093 // On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
16095 {
16096 ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
16097 }
16098 // Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
16099 else if (isVictim && procExtra & (PROC_EX_BLOCK))
16100 {
16101 ToPlayer()->UpdateCombatSkills(target, attType, true);
16102 }
16103 }
16104 // If exist crit/parry/dodge/block need update aura state (for victim and attacker)
16106 {
16107 // for victim
16108 if (isVictim)
16109 {
16110 // if victim and dodge attack
16111 if (procExtra & PROC_EX_DODGE)
16112 {
16113 // Update AURA_STATE on dodge
16114 if (!IsClass(CLASS_ROGUE, CLASS_CONTEXT_ABILITY_REACTIVE)) // skip Rogue Riposte
16115 {
16118 }
16119 }
16120 // if victim and parry attack
16121 if (procExtra & PROC_EX_PARRY)
16122 {
16123 // For Hunters only Counterattack (skip Mongoose bite)
16125 {
16128 }
16129 else
16130 {
16133 }
16134 }
16135 // if and victim block attack
16136 if (procExtra & PROC_EX_BLOCK)
16137 {
16140 }
16141 }
16142 else // For attacker
16143 {
16144 // Overpower on victim dodge
16145 if (procExtra & PROC_EX_DODGE)
16146 {
16148 {
16149 AddComboPoints(target, 1);
16151 }
16152 }
16153
16154 // Wolverine Bite
16155 if ((procExtra & PROC_HIT_CRITICAL) && IsHunterPet())
16156 {
16157 AddComboPoints(target, 1);
16159 }
16160 }
16161 }
16162 }
16163
16164 Unit* actor = isVictim ? target : this;
16165 Unit* actionTarget = !isVictim ? target : this;
16166
16167 ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, procPhase, procExtra, procSpell, damageInfo, healInfo, procAura, procAuraEffectIndex);
16168
16169 ProcTriggeredList procTriggered;
16170 // Fill procTriggered list
16171 for (AuraApplicationMap::const_iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
16172 {
16173 // Do not allow auras to proc from effect triggered by itself
16174 if (procAura && procAura->Id == itr->first)
16175 continue;
16176
16177 // Xinef: Generic Item Equipment cooldown, -1 is a special marker
16178 if (itr->second->GetBase()->GetCastItemGUID() && HasSpellItemCooldown(itr->first, uint32(-1)))
16179 continue;
16180
16181 ProcTriggeredData triggerData(itr->second->GetBase());
16182 // Defensive procs are active on absorbs (so absorption effects are not a hindrance)
16183 bool active = damage || (procExtra & PROC_EX_BLOCK && isVictim);
16184 if (isVictim)
16185 procExtra &= ~PROC_EX_INTERNAL_REQ_FAMILY;
16186
16187 SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
16188
16189 // only auras that have trigger spell should proc from fully absorbed damage
16190 if (procExtra & PROC_EX_ABSORB && isVictim)
16191 if (damage || spellProto->Effects[EFFECT_0].TriggerSpell || spellProto->Effects[EFFECT_1].TriggerSpell || spellProto->Effects[EFFECT_2].TriggerSpell)
16192 active = true;
16193
16194 // xinef: fix spell procing from damaging / healing casts if spell has DoT / HoT effect only
16195 // only player spells are taken into account
16196 if (!active && !isVictim && !(procFlag & PROC_FLAG_DONE_PERIODIC) && procSpellInfo && procSpellInfo->SpellFamilyName && (procSpellInfo->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || procSpellInfo->HasAura(SPELL_AURA_PERIODIC_HEAL)))
16197 active = true;
16198
16199 // AuraScript Hook
16200 if (!triggerData.aura->CallScriptCheckProcHandlers(itr->second, eventInfo))
16201 {
16202 continue;
16203 }
16204
16205 bool isTriggeredAtSpellProcEvent = IsTriggeredAtSpellProcEvent(target, triggerData.aura, attType, isVictim, active, triggerData.spellProcEvent, eventInfo);
16206
16207 // AuraScript Hook
16208 if (!triggerData.aura->CallScriptAfterCheckProcHandlers(itr->second, eventInfo, isTriggeredAtSpellProcEvent))
16209 {
16210 continue;
16211 }
16212
16213 // do checks using conditions table
16214 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, spellProto->Id);
16215 ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
16216 if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
16217 {
16218 continue;
16219 }
16220
16221 // Triggered spells not triggering additional spells
16222 //bool triggered = !spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) ?
16223 // (procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION)) : false;
16224
16225 bool hasTriggeredProc = false;
16226 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
16227 {
16228 if (itr->second->HasEffect(i))
16229 {
16230 AuraEffect* aurEff = itr->second->GetBase()->GetEffect(i);
16231
16232 // Skip this auras
16233 if (isNonTriggerAura[aurEff->GetAuraType()])
16234 continue;
16235
16236 // If not trigger by default and spellProcEvent == nullptr - skip
16237 if (!isTriggerAura[aurEff->GetAuraType()] && !triggerData.spellProcEvent)
16238 continue;
16239
16240 switch (aurEff->GetAuraType())
16241 {
16244 case SPELL_AURA_DUMMY:
16246 if (uint32 triggerSpellId = aurEff->GetSpellInfo()->Effects[i].TriggerSpell)
16247 {
16248 triggerData.triggerSpelId[i] = triggerSpellId;
16249 hasTriggeredProc = true;
16250 }
16251 break;
16252 default:
16253 break;
16254 }
16255
16256 // Some spells must always trigger
16257 //if (isAlwaysTriggeredAura[aurEff->GetAuraType()])
16258 triggerData.effMask |= 1 << i;
16259 }
16260 }
16261
16262 if (triggerData.effMask)
16263 {
16264 // If there is aura that triggers another proc aura, make sure that the triggered one is going to be proccessed on top of it
16265 if (hasTriggeredProc)
16266 {
16267 bool proccessed = false;
16268 for (uint8 i = 0; i < EFFECT_ALL; ++i)
16269 {
16270 if (uint32 triggeredSpellId = triggerData.triggerSpelId[i])
16271 {
16272 auto iter = std::find(procTriggered.begin(), procTriggered.end(), triggeredSpellId);
16273 if (iter != procTriggered.end())
16274 {
16275 std::advance(iter, 1);
16276 procTriggered.insert(iter, triggerData);
16277 proccessed = true;
16278 break;
16279 }
16280 }
16281 }
16282
16283 if (!proccessed)
16284 {
16285 procTriggered.push_front(triggerData);
16286 }
16287 }
16288 else
16289 {
16290 procTriggered.push_front(triggerData);
16291 }
16292 }
16293 }
16294
16295 // Nothing found
16296 if (procTriggered.empty())
16297 return;
16298
16299 // Note: must SetCantProc(false) before return
16301 SetCantProc(true);
16302
16303 // Handle effects proceed this time
16304 for (ProcTriggeredList::const_iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
16305 {
16306 // look for aura in auras list, it may be removed while proc event processing
16307 if (i->aura->IsRemoved())
16308 continue;
16309
16310 bool useCharges = i->aura->IsUsingCharges();
16311 // no more charges to use, prevent proc
16312 if (useCharges && !i->aura->GetCharges())
16313 continue;
16314
16315 bool takeCharges = false;
16316 SpellInfo const* spellInfo = i->aura->GetSpellInfo();
16317
16318 AuraApplication* aurApp = i->aura->GetApplicationOfTarget(GetGUID());
16319
16320 bool prepare = i->aura->CallScriptPrepareProcHandlers(aurApp, eventInfo);
16321
16322 // For players set spell cooldown if need
16323 uint32 cooldown = 0;
16324 if (prepare && i->spellProcEvent && i->spellProcEvent->cooldown)
16325 cooldown = i->spellProcEvent->cooldown;
16326
16327 // Xinef: set cooldown for actual proc
16328 eventInfo.SetProcCooldown(cooldown);
16329
16330 // Note: must SetCantProc(false) before return
16332 SetCantProc(true);
16333
16334 bool handled = i->aura->CallScriptProcHandlers(aurApp, eventInfo);
16335
16336 // "handled" is needed as long as proc can be handled in multiple places
16337 if (!handled && HandleAuraProc(target, damage, i->aura, procSpellInfo, procFlag, procExtra, cooldown, &handled))
16338 {
16339 uint32 Id = i->aura->GetId();
16340 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered with value by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), Id);
16341 takeCharges = true;
16342 }
16343
16344 if (!handled)
16345 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
16346 {
16347 if (!(i->effMask & (1 << effIndex)))
16348 continue;
16349
16350 AuraEffect* triggeredByAura = i->aura->GetEffect(effIndex);
16351 ASSERT(triggeredByAura);
16352
16353 bool prevented = i->aura->CallScriptEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
16354 if (prevented)
16355 {
16356 takeCharges = true;
16357 continue;
16358 }
16359
16360 switch (triggeredByAura->GetAuraType())
16361 {
16363 {
16364 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16365 // Don`t drop charge or add cooldown for not started trigger
16366 if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procPhase, eventInfo))
16367 takeCharges = true;
16368 break;
16369 }
16371 {
16372 // target has to be valid
16373 if (!eventInfo.GetProcTarget())
16374 break;
16375
16376 triggeredByAura->HandleProcTriggerDamageAuraProc(aurApp, eventInfo); // this function is part of the new proc system
16377 takeCharges = true;
16378 break;
16379 }
16381 case SPELL_AURA_DUMMY:
16382 {
16383 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} dummy aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16384 if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, eventInfo))
16385 takeCharges = true;
16386 break;
16387 }
16392 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} aura of spell {})", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId());
16393 takeCharges = true;
16394 break;
16396 {
16397 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16398 if (HandleOverrideClassScriptAuraProc(target, damage, triggeredByAura, procSpellInfo, cooldown))
16399 takeCharges = true;
16400 break;
16401 }
16403 {
16404 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by {} dummy aura of spell {})",
16405 (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16406 if (damage > 0)
16407 {
16409 takeCharges = true;
16410 }
16411 break;
16412 }
16414 {
16415 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by {} dummy aura of spell {})",
16416 (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16417 HandleAuraRaidProcFromCharge(triggeredByAura);
16418 takeCharges = true;
16419 break;
16420 }
16422 {
16423 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered with value by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16424
16425 if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procPhase, eventInfo))
16426 takeCharges = true;
16427 break;
16428 }
16430 // Skip melee hits or instant cast spells
16431 // xinef: check channeled spells which are affected by haste also
16432 if (procSpellInfo && (procSpellInfo->SpellFamilyName || !IsPlayer()) &&
16433 (procSpellInfo->CalcCastTime() > 0 /*||
16434 (procSpell->IsChanneled() && procSpell->GetDuration() > 0 && (HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, procSpell) || procSpell->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC)))*/))
16435 takeCharges = true;
16436 break;
16438 // Skip Melee hits and spells ws wrong school
16439 if (procSpellInfo && (triggeredByAura->GetMiscValue() & procSpellInfo->SchoolMask)) // School check
16440 takeCharges = true;
16441 break;
16443 // Skip Melee hits and targets with magnet aura
16444 if (procSpellInfo && (triggeredByAura->GetBase()->GetUnitOwner()->ToUnit() == ToUnit())) // Magnet
16445 takeCharges = true;
16446 break;
16449 // Skip melee hits and spells ws wrong school or zero cost
16450 if (procSpellInfo &&
16451 (procSpellInfo->ManaCost != 0 || procSpellInfo->ManaCostPercentage != 0 || (procSpellInfo->SpellFamilyFlags[1] & 0x2)) && // Cost check, mutilate include
16452 (triggeredByAura->GetMiscValue() & procSpellInfo->SchoolMask)) // School check
16453 takeCharges = true;
16454 break;
16457 // Compare mechanic
16458 if (procSpellInfo && procSpellInfo->Mechanic == uint32(triggeredByAura->GetMiscValue()))
16459 takeCharges = true;
16460 break;
16462 // Compare casters
16463 if (target && triggeredByAura->GetCasterGUID() == target->GetGUID())
16464 takeCharges = true;
16465 break;
16466 // CC Auras which use their amount amount to drop
16467 // Are there any more auras which need this?
16473 {
16474 // Spell own direct damage at apply wont break the CC
16475 // Xinef: Or when the aura is at full duration (assume that such auras should be added at the end, skipping all damage procs etc.)
16476 if (procSpellInfo)
16477 if ((!i->aura->IsPermanent() && i->aura->GetDuration() == i->aura->GetMaxDuration()) || procSpellInfo->Id == triggeredByAura->GetId() ||
16478 procSpellInfo->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
16479 break;
16480
16481 // chargeable mods are breaking on hit
16482 if (useCharges)
16483 takeCharges = true;
16484 else if (triggeredByAura->GetAmount()) // aura must have amount
16485 {
16486 int32 damageLeft = triggeredByAura->GetAmount();
16487 // No damage left
16488 if (damageLeft < int32(damage))
16489 i->aura->Remove();
16490 else
16491 triggeredByAura->SetAmount(damageLeft - damage);
16492 }
16493 break;
16494 }
16496 if (procSpellInfo && procSpellInfo->Id == 20647) // hack for warriors execute, both dummy and damage spell are affected by ignore aurastate aura
16497 break;
16498 takeCharges = true;
16499 break;
16502 {
16503 if (triggeredByAura->GetSpellModifier())
16504 {
16505 // Do proc if mod is consumed by spell
16506 if (!procSpell || procSpell->m_appliedMods.find(i->aura) != procSpell->m_appliedMods.end())
16507 {
16508 takeCharges = true;
16509 }
16510 }
16511 break;
16512 }
16513 default:
16514 takeCharges = true;
16515 break;
16516 }
16517 i->aura->CallScriptAfterEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
16518 }
16519 // Remove charge (aura can be removed by triggers)
16520 // xinef: take into account attribute6 of proc spell
16521 if (prepare && useCharges && takeCharges)
16522 if (!procSpellInfo || isVictim || !procSpellInfo->HasAttribute(SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES))
16523 i->aura->DropCharge();
16524
16525 i->aura->CallScriptAfterProcHandlers(aurApp, eventInfo);
16526
16528 SetCantProc(false);
16529 }
16530
16531 // Cleanup proc requirements
16533 SetCantProc(false);
16534}
@ CONDITION_SOURCE_TYPE_SPELL_PROC
Definition ConditionMgr.h:147
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_ATTR3_INSTANT_TARGET_PROCS
Definition SharedDefines.h:512
#define EFFECT_ALL
Definition SharedDefines.h:38
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
Definition SharedDefines.h:609
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition SpellAuraDefines.h:288
@ SPELL_AURA_ADD_PCT_MODIFIER
Definition SpellAuraDefines.h:171
@ SPELL_AURA_OBS_MOD_POWER
Definition SpellAuraDefines.h:84
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition SpellAuraDefines.h:170
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition SpellAuraDefines.h:120
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition SpellAuraDefines.h:135
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition SpellAuraDefines.h:136
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition SpellAuraDefines.h:140
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
Definition SpellAuraDefines.h:286
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition SpellAuraDefines.h:106
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition SpellAuraDefines.h:137
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
Definition SpellAuraDefines.h:128
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:253
#define MELEE_BASED_TRIGGER_MASK
Definition SpellMgr.h:182
@ PROC_EX_INTERNAL_CANT_PROC
Definition SpellMgr.h:218
@ PROC_EX_INTERNAL_TRIGGERED
Definition SpellMgr.h:221
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:134
static bool isNonTriggerAura[TOTAL_AURAS]
Definition Unit.cpp:104
static bool isTriggerAura[TOTAL_AURAS]
Definition Unit.cpp:102
std::list< ProcTriggeredData > ProcTriggeredList
Definition Unit.cpp:15877
@ REACTIVE_OVERPOWER
Definition Unit.h:596
@ REACTIVE_DEFENSE
Definition Unit.h:594
@ REACTIVE_HUNTER_PARRY
Definition Unit.h:595
@ REACTIVE_WOLVERINE_BITE
Definition Unit.h:597
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition SpellAuraEffects.cpp:7257
SpellModifier * GetSpellModifier() const
Definition SpellAuraEffects.h:52
Unit * GetUnitOwner() const
Definition SpellAuras.h:108
void UpdateCombatSkills(Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
Definition PlayerUpdates.cpp:982
Definition Unit.h:420
void SetProcCooldown(uint32 cooldown)
Definition Unit.h:454
Unit * GetActionTarget() const
Definition Unit.h:440
Unit * GetProcTarget() const
Definition Unit.h:441
bool HandleProcTriggerSpell(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
Definition Unit.cpp:8957
bool HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura)
Definition Unit.cpp:17585
bool IsHunterPet() const
Definition Unit.h:761
bool IsTriggeredAtSpellProcEvent(Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
Definition Unit.cpp:17446
bool HandleAuraProc(Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
Definition Unit.cpp:8762
virtual bool HasSpellItemCooldown(uint32, uint32) const
Definition Unit.h:1267
bool HandleDummyAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, ProcEventInfo const &eventInfo)
Definition Unit.cpp:6612
void StartReactiveTimer(ReactiveType reactive)
Definition Unit.h:1765
bool HandleOverrideClassScriptAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
Definition Unit.cpp:9884
bool HandleAuraRaidProcFromCharge(AuraEffect *triggeredByAura)
Definition Unit.cpp:17674
bool IsCharmedOwnedByPlayerOrPlayer() const
Definition Unit.h:1240
Definition Unit.cpp:15858

References AddComboPoints(), ASSERT, ProcTriggeredData::aura, AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, SpellInfo::CalcCastTime(), Aura::CallScriptAfterCheckProcHandlers(), Aura::CallScriptCheckProcHandlers(), CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_ROGUE, CLASS_WARRIOR, CONDITION_SOURCE_TYPE_SPELL_PROC, EFFECT_0, EFFECT_1, EFFECT_2, EFFECT_ALL, SpellInfo::Effects, ProcTriggeredData::effMask, FORM_GHOSTWOLF, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), AuraEffect::GetAmount(), GetAppliedAuras(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), AuraEffect::GetCasterGUID(), Aura::GetEffect(), Object::GetGUID(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), ProcEventInfo::GetProcTarget(), GetShapeshiftForm(), AuraEffect::GetSpellInfo(), AuraEffect::GetSpellModifier(), Aura::GetUnitOwner(), HandleAuraProc(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), HandleDummyAuraProc(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpell(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasSpellItemCooldown(), SpellInfo::Id, IsCharmedOwnedByPlayerOrPlayer(), IsClass(), IsHunterPet(), isNonTriggerAura, Object::IsPlayer(), isTriggerAura, IsTriggeredAtSpellProcEvent(), LOG_DEBUG, Spell::m_appliedMods, Spell::m_weaponItem, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, MELEE_BASED_TRIGGER_MASK, ModifyAuraState(), PROC_EX_ABSORB, PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_INTERNAL_CANT_PROC, PROC_EX_INTERNAL_TRIGGERED, PROC_EX_MISS, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_RESIST, PROC_FLAG_DONE_PERIODIC, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, REACTIVE_WOLVERINE_BITE, SpellInfo::SchoolMask, sConditionMgr, AuraEffect::SetAmount(), SetCantProc(), ProcEventInfo::SetProcCooldown(), SPELL_ATTR3_INSTANT_TARGET_PROCS, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES, SPELL_AURA_ABILITY_IGNORE_AURASTATE, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_DUMMY, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MECHANIC_IMMUNITY, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_MECHANIC_RESISTANCE, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_MOD_POWER_COST_SCHOOL, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_STUN, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_RAID_PROC_FROM_CHARGE, SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_AURA_SPELL_MAGNET, SPELL_AURA_TRANSFORM, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, ProcTriggeredData::spellProcEvent, StartReactiveTimer(), Object::ToPlayer(), Object::ToUnit(), ProcTriggeredData::triggerSpelId, and Player::UpdateCombatSkills().

Referenced by CalcAbsorbResist(), and ProcDamageAndSpell().

◆ processDummyAuras()

float Unit::processDummyAuras ( float  TakenTotalMod) const
private
11926{
11927 // note: old code coming from TC, just extracted here to remove the code duplication + solve potential crash
11928 // see: https://github.com/TrinityCore/TrinityCore/commit/c85710e148d75450baedf6632b9ca6fd40b4148e
11929
11930 // .. taken pct: dummy auras
11931 auto const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
11932 for (auto i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
11933 {
11934 if (!(*i) || !(*i)->GetSpellInfo())
11935 {
11936 continue;
11937 }
11938
11939 if (auto spellIconId = (*i)->GetSpellInfo()->SpellIconID)
11940 {
11941 switch (spellIconId)
11942 {
11943 // Cheat Death
11944 case 2109:
11945 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
11946 {
11947 // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
11948 // is 22.5% critical strike damage reduction, or 444 resilience.
11949 // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
11950 float mod = -1.0f * GetMeleeCritDamageReduction(400);
11951 AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
11952 }
11953 break;
11954 }
11955 }
11956 }
11957 return TakenTotalMod;
11958}

References AddPct(), GetAuraEffectsByType(), GetMeleeCritDamageReduction(), SPELL_AURA_DUMMY, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by MeleeDamageBonusTaken(), and SpellDamageBonusTaken().

◆ ProcessPositionDataChanged()

void Unit::ProcessPositionDataChanged ( PositionFullTerrainStatus const &  data)
overridevirtual

Reimplemented from WorldObject.

4255{
4258}
virtual void ProcessTerrainStatusUpdate()
Definition Unit.cpp:4260
virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const &data)
Definition Object.cpp:1174

References WorldObject::ProcessPositionDataChanged(), and ProcessTerrainStatusUpdate().

Referenced by Creature::Create().

◆ ProcessTerrainStatusUpdate()

void Unit::ProcessTerrainStatusUpdate ( )
virtual

Reimplemented in Player.

4261{
4262 if (IsCreature())
4264
4265 if (IsFlying() || (!IsControlledByPlayer()))
4266 return;
4267
4268 LiquidData const& liquidData = GetLiquidData();
4269
4270 // remove appropriate auras if we are swimming/not swimming respectively
4271 if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING)
4273 else if (!isSwimming())
4275
4276 // liquid aura handling
4277 LiquidTypeEntry const* curLiquid = nullptr;
4278 if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING))
4279 curLiquid = sLiquidTypeStore.LookupEntry(liquidData.Entry);
4280
4281 if (curLiquid != _lastLiquid)
4282 {
4285
4286 // Set _lastLiquid before casting liquid spell to avoid infinite loops
4287 _lastLiquid = curLiquid;
4288
4290 if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
4291 CastSpell(this, curLiquid->SpellId, true);
4292 }
4293}
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition SpellDefines.h:50
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition SpellDefines.h:51
void UpdateMovementFlags()
Definition Creature.cpp:3436
bool isSwimming() const
Definition Unit.h:1628
bool IsFlying() const
Definition Unit.h:1630
Definition Map.h:169
uint32 Entry
Definition Map.h:172
Definition DBCStructure.h:1282
uint32 SpellId
Definition DBCStructure.h:1288

References _lastLiquid, AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, CastSpell(), LiquidData::Entry, GetCharmerOrOwnerPlayerOrPlayerItself(), WorldObject::GetLiquidData(), IsControlledByPlayer(), Object::IsCreature(), IsFlying(), Player::IsGameMaster(), isSwimming(), MAP_LIQUID_STATUS_SWIMMING, RemoveAurasDueToSpell(), RemoveAurasWithInterruptFlags(), sLiquidTypeStore, LiquidTypeEntry::SpellId, LiquidData::Status, Object::ToCreature(), and Creature::UpdateMovementFlags().

Referenced by ProcessPositionDataChanged(), and Player::ProcessTerrainStatusUpdate().

◆ ProhibitSpellSchool()

virtual void Unit::ProhibitSpellSchool ( SpellSchoolMask  ,
uint32   
)
inlinevirtual

Reimplemented in Creature, and Player.

1506{ }

Referenced by Spell::EffectInterruptCast().

◆ propagateSpeedChange()

void Unit::propagateSpeedChange ( )
inline
void propagateSpeedChange()
Definition MotionMaster.cpp:890

References GetMotionMaster(), and MotionMaster::propagateSpeedChange().

Referenced by SetSpeed(), and SetWalk().

◆ RecalculateObjectScale()

void Unit::RecalculateObjectScale ( )
virtual
16778{
16780 float scale = GetNativeObjectScale() + CalculatePct(1.0f, scaleAuras);
16781 float scaleMin = IsPlayer() ? 0.1f : 0.01f;
16782 SetObjectScale(std::max(scale, scaleMin));
16783}
@ SPELL_AURA_MOD_SCALE_2
Definition SpellAuraDefines.h:302
@ SPELL_AURA_MOD_SCALE
Definition SpellAuraDefines.h:124
virtual void SetObjectScale(float scale)
Definition Object.h:119
virtual float GetNativeObjectScale() const
Definition Unit.h:1885

References CalculatePct(), GetNativeObjectScale(), GetTotalAuraModifier(), Object::IsPlayer(), Object::SetObjectScale(), SPELL_AURA_MOD_SCALE, and SPELL_AURA_MOD_SCALE_2.

Referenced by AuraEffect::HandleAuraModScale().

◆ RemoveAllAttackers()

void Unit::RemoveAllAttackers ( )

Remove all units in m_attackers list and send them AttackStop()

10508{
10509 while (!m_attackers.empty())
10510 {
10511 AttackerSet::iterator iter = m_attackers.begin();
10512 if (!(*iter)->AttackStop())
10513 {
10514 LOG_ERROR("entities.unit", "WORLD: Unit has an attacker that isn't attacking it!");
10515 m_attackers.erase(iter);
10516 }
10517 }
10518}

References LOG_ERROR, and m_attackers.

Referenced by CombatStop(), Spell::EffectSanctuary(), boss_kaelthas::ExecuteMiddleEvent(), AuraEffect::HandleFeignDeath(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), boss_attumen::SpellHit(), and npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI().

◆ RemoveAllAuras()

void Unit::RemoveAllAuras ( )
5320{
5321 // this may be a dead loop if some events on aura remove will continiously apply aura on remove
5322 // we want to have all auras removed, so use your brain when linking events
5323 while (!m_appliedAuras.empty() || !m_ownedAuras.empty())
5324 {
5325 AuraApplicationMap::iterator aurAppIter;
5326 for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
5328
5329 AuraMap::iterator aurIter;
5330 for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
5331 RemoveOwnedAura(aurIter);
5332 }
5333}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by CleanupBeforeRemoveFromMap(), npc_mograine::npc_mograineAI::DamageTaken(), boss_muru::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_taldaram::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), boss_leotheras_the_blind::DoAction(), boss_kalecgos::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), boss_razorgore::boss_razorgoreAI::DoChangePhase(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_mimiron::boss_mimironAI::EnterEvadeMode(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::EnterEvadeMode(), npc_ulduar_vx001::npc_ulduar_vx001AI::EnterEvadeMode(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), spell_herald_volzaj_insanity::HandleDummyEffect(), misc_commandscript::HandleUnAuraCommand(), boss_ick::boss_ickAI::JustDied(), boss_venoxis::JustDied(), boss_taldaram::JustEngagedWith(), boss_mimiron::boss_mimironAI::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_novos::boss_novosAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_commander_stoutbeard::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_steelbreaker::boss_steelbreakerAI::JustReachedHome(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustReachedHome(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustReachedHome(), boss_urom::boss_uromAI::LeaveCombat(), boss_taldaram::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), spell_kaelthas_flame_strike::OnRemove(), PretendToDie(), boss_alar::PretendToDie(), Creature::RemoveCorpse(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), boss_venoxis::Reset(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_bjarngrim::boss_bjarngrimAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_hodir::boss_hodirAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_skadi::boss_skadiAI::Reset(), boss_skadi_grauf::boss_skadi_graufAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), Pet::SavePetToDB(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), npc_harrison_jones::SpellHit(), npc_frost_sphere::npc_frost_sphereAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_magus_telestra::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ RemoveAllAurasExceptType()

void Unit::RemoveAllAurasExceptType ( AuraType  type)
5394{
5395 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5396 {
5397 Aura const* aura = iter->second->GetBase();
5398 if (aura->GetSpellInfo()->HasAura(type))
5399 ++iter;
5400 else
5402 }
5403
5404 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5405 {
5406 Aura* aura = iter->second;
5407 if (aura->GetSpellInfo()->HasAura(type))
5408 ++iter;
5409 else
5411 }
5412}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), SpellInfo::HasAura(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ RemoveAllAurasOnDeath()

void Unit::RemoveAllAurasOnDeath ( )
5350{
5351 // used just after dieing to remove all visible auras
5352 // and disable the mods for the passive ones
5353 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5354 {
5355 Aura const* aura = iter->second->GetBase();
5358 else
5359 ++iter;
5360 }
5361
5362 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5363 {
5364 Aura* aura = iter->second;
5367 else
5368 ++iter;
5369 }
5370}
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
Definition SharedDefines.h:643
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
bool IsDeathPersistent() const
Definition SpellAuras.cpp:1087

References _UnapplyAura(), AURA_REMOVE_BY_DEATH, Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsDeathPersistent(), Aura::IsPassive(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), and SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD.

Referenced by spell_dk_death_pact::FilterTargets(), Kill(), Player::LoadFromDB(), and setDeathState().

◆ RemoveAllAurasRequiringDeadTarget()

void Unit::RemoveAllAurasRequiringDeadTarget ( )
5373{
5374 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5375 {
5376 Aura const* aura = iter->second->GetBase();
5377 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5379 else
5380 ++iter;
5381 }
5382
5383 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5384 {
5385 Aura* aura = iter->second;
5386 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5388 else
5389 ++iter;
5390 }
5391}
bool IsRequiringDeadTarget() const
Definition SpellInfo.cpp:1222

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), Aura::IsPassive(), SpellInfo::IsRequiringDeadTarget(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by Player::LoadFromDB().

◆ RemoveAllControlled()

void Unit::RemoveAllControlled ( bool  onDeath = false)
11110{
11111 // possessed pet and vehicle
11112 if (IsPlayer())
11114
11115 while (!m_Controlled.empty())
11116 {
11117 Unit* target = *m_Controlled.begin();
11118 m_Controlled.erase(m_Controlled.begin());
11119 if (target->GetCharmerGUID() == GetGUID())
11120 {
11121 target->RemoveCharmAuras();
11122 }
11123 else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon())
11124 {
11125 if (!(onDeath && !IsPlayer() && target->IsGuardian()))
11126 {
11127 target->ToTempSummon()->UnSummon();
11128 }
11129 }
11130 else
11131 {
11132 LOG_ERROR("entities.unit", "Unit {} is trying to release unit {} which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
11133 }
11134 }
11135}
void StopCastingCharm(Aura *except=nullptr)
Definition Player.cpp:9326
bool IsGuardian() const
Definition Unit.h:758
void RemoveCharmAuras()
Definition Unit.cpp:11220

References GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), IsGuardian(), Object::IsPlayer(), IsSummon(), LOG_ERROR, m_Controlled, RemoveCharmAuras(), Player::StopCastingCharm(), Object::ToPlayer(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ RemoveAllDynObjects()

void Unit::RemoveAllDynObjects ( )
6187{
6188 while (!m_dynObj.empty())
6189 m_dynObj.front()->Remove();
6190}

References m_dynObj.

Referenced by RemoveFromWorld(), Player::TeleportTo(), and npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI().

◆ RemoveAllGameObjects()

void Unit::RemoveAllGameObjects ( )
6287{
6288 while(!m_gameObj.empty())
6289 {
6290 GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin());
6291 if (go)
6292 {
6294 go->SetRespawnTime(0);
6295 go->Delete();
6296 }
6297 m_gameObj.erase(m_gameObj.begin());
6298 }
6299}
void Delete()
Definition GameObject.cpp:981
void SetRespawnTime(int32 respawn)
Definition GameObject.cpp:1305

References GameObject::Delete(), ObjectGuid::Empty, ObjectAccessor::GetGameObject(), m_gameObj, GameObject::SetOwnerGUID(), and GameObject::SetRespawnTime().

Referenced by CleanupBeforeRemoveFromMap(), npc_ice_tomb::npc_ice_tombAI::JustDied(), RemoveFromWorld(), npc_brewfest_super_brew_trigger::UpdateAI(), and boss_sapphiron::boss_sapphironAI::UpdateAI().

◆ RemoveAllMinionsByEntry()

void Unit::RemoveAllMinionsByEntry ( uint32  entry)
10887{
10888 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10889 {
10890 Unit* unit = *itr;
10891 ++itr;
10892 if (unit->GetEntry() == entry && unit->IsCreature()
10893 && unit->ToCreature()->IsSummon()) // minion, actually
10894 unit->ToTempSummon()->UnSummon();
10895 // i think this is safe because i have never heard that a despawned minion will trigger a same minion
10896 }
10897}

References Object::GetEntry(), Object::IsCreature(), IsSummon(), m_Controlled, Object::ToCreature(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Player::ApplyEquipSpell(), Spell::EffectSummonType(), npc_nelson::npc_nelsonAI::Reset(), SetMinion(), and npc_nelson::npc_nelsonAI::UpdateAI().

◆ RemoveAppliedAuras() [1/2]

void Unit::RemoveAppliedAuras ( std::function< bool(AuraApplication const *)> const &  check)
4871{
4872 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
4873 {
4874 if (check(iter->second))
4875 {
4876 RemoveAura(iter);
4877 continue;
4878 }
4879 ++iter;
4880 }
4881}

References m_appliedAuras, and RemoveAura().

Referenced by RemoveArenaAuras().

◆ RemoveAppliedAuras() [2/2]

void Unit::RemoveAppliedAuras ( uint32  spellId,
std::function< bool(AuraApplication const *)> const &  check 
)
4897{
4898 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4899 {
4900 if (check(iter->second))
4901 {
4902 RemoveAura(iter);
4903 continue;
4904 }
4905 ++iter;
4906 }
4907}

References m_appliedAuras, and RemoveAura().

◆ RemoveAreaAurasDueToLeaveWorld()

void Unit::RemoveAreaAurasDueToLeaveWorld ( )
5287{
5288 // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
5289 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5290 {
5291 Aura* aura = iter->second;
5292 ++iter;
5293 Aura::ApplicationMap const& appMap = aura->GetApplicationMap();
5294 for (Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr != appMap.end();)
5295 {
5296 AuraApplication* aurApp = itr->second;
5297 ++itr;
5298 Unit* target = aurApp->GetTarget();
5299 if (target == this)
5300 continue;
5301 target->RemoveAura(aurApp);
5302 // things linked on aura remove may apply new area aura - so start from the beginning
5303 iter = m_ownedAuras.begin();
5304 }
5305 }
5306
5307 // remove area auras owned by others
5308 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5309 {
5310 if (iter->second->GetBase()->GetOwner() != this)
5311 {
5312 RemoveAura(iter);
5313 }
5314 else
5315 ++iter;
5316 }
5317}
ApplicationMap const & GetApplicationMap()
Definition SpellAuras.h:181
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition SpellAuras.h:90

References Aura::GetApplicationMap(), AuraApplication::GetTarget(), m_appliedAuras, m_ownedAuras, and RemoveAura().

Referenced by RemoveFromWorld().

◆ RemoveArenaAuras()

void Unit::RemoveArenaAuras ( )
5336{
5337 // in join, remove positive buffs, on end, remove negative
5338 // used to remove positive visible auras in arenas
5339 RemoveAppliedAuras([](AuraApplication const* aurApp)
5340 {
5341 Aura const* aura = aurApp->GetBase();
5342 return (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_ALLOW_ENETRING_ARENA) // don't remove stances, shadowform, pally/hunter auras
5343 && !aura->IsPassive() // don't remove passive auras
5344 && (aurApp->IsPositive() || !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD))) || // not negative death persistent auras
5345 aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ENTERING_ARENA); // special marker, always remove
5346 });
5347}
@ SPELL_ATTR5_REMOVE_ENTERING_ARENA
Definition SharedDefines.h:569
@ SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD
Definition SharedDefines.h:513
@ SPELL_ATTR4_ALLOW_ENETRING_ARENA
Definition SharedDefines.h:551
bool IsPositive() const
Definition SpellAuras.h:68
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition Unit.cpp:4870

References AuraApplication::GetBase(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsPassive(), AuraApplication::IsPositive(), RemoveAppliedAuras(), SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD, SPELL_ATTR4_ALLOW_ENETRING_ARENA, and SPELL_ATTR5_REMOVE_ENTERING_ARENA.

Referenced by Player::TeleportTo().

◆ RemoveAura() [1/4]

void Unit::RemoveAura ( Aura aur,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4850{
4851 if (aura->IsRemoved())
4852 return;
4853 if (AuraApplication* aurApp = aura->GetApplicationOfTarget(GetGUID()))
4854 RemoveAura(aurApp, mode);
4855}

References Aura::GetApplicationOfTarget(), Object::GetGUID(), Aura::IsRemoved(), and RemoveAura().

◆ RemoveAura() [2/4]

void Unit::RemoveAura ( AuraApplication aurApp,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4807{
4808 // we've special situation here, RemoveAura called while during aura removal
4809 // this kind of call is needed only when aura effect removal handler
4810 // or event triggered by it expects to remove
4811 // not yet removed effects of an aura
4812 if (aurApp->GetRemoveMode())
4813 {
4814 // remove remaining effects of an aura
4815 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4816 {
4817 if (aurApp->HasEffect(itr))
4818 aurApp->_HandleEffect(itr, false);
4819 }
4820 return;
4821 }
4822 // no need to remove
4823 if (aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) != aurApp || aurApp->GetBase()->IsRemoved())
4824 return;
4825
4826 uint32 spellId = aurApp->GetBase()->GetId();
4827 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4828
4829 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4830 {
4831 if (aurApp == iter->second)
4832 {
4833 // Prevent Arena Preparation aura from being removed by player actions
4834 // It's an invisibility spell so any interaction/spell cast etc. removes it.
4835 // Should only be removed by the arena script, once the match starts.
4837 {
4838 return;
4839 }
4840
4841 RemoveAura(iter, mode);
4842 return;
4843 }
4844 else
4845 ++iter;
4846 }
4847}
@ SPELL_AURA_ARENA_PREPARATION
Definition SpellAuraDefines.h:278

References AuraApplication::_HandleEffect(), Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), AuraApplication::GetRemoveMode(), AuraApplication::HasEffect(), Aura::HasEffectType(), Aura::IsRemoved(), m_appliedAuras, MAX_SPELL_EFFECTS, RemoveAura(), and SPELL_AURA_ARENA_PREPARATION.

◆ RemoveAura() [3/4]

void Unit::RemoveAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4777{
4778 AuraApplication* aurApp = i->second;
4779 // Do not remove aura which is already being removed
4780 if (aurApp->GetRemoveMode())
4781 return;
4782 Aura* aura = aurApp->GetBase();
4783 _UnapplyAura(i, mode);
4784 // Remove aura - for Area and Target auras
4785 if (aura->GetOwner() == this)
4786 aura->Remove(mode);
4787}

References _UnapplyAura(), AuraApplication::GetBase(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), and Aura::Remove().

Referenced by _RemoveNoStackAurasDueToAura(), boss_marli::_schedulePhaseTroll(), ApplySpellDispelImmunity(), Player::CheckAreaExploreAndOutdoor(), boss_headless_horseman::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_hor_lich_king::npc_hor_lich_kingAI::DoAction(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), npc_harrison_jones::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_paletress::boss_paletressAI::DoAction(), boss_vezax::boss_vezaxAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DoAction(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::DoAction(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), Player::DuelComplete(), Spell::EffectDispelMechanic(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectSummonPet(), Spell::EffectTriggerSpell(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), GetDiseasesByCaster(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_q12096_q12092_bark::HandleDummy(), HandleDummyAuraProc(), spell_valanar_kinetic_bomb_aura::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_midsummer_ribbon_pole::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), spell_dk_presence::HandleEffectRemove(), spell_pal_blessing_of_sanctuary::HandleEffectRemove(), spell_sha_chain_heal::HandleHeal(), spell_sindragosa_frost_breath::HandleInfusion(), spell_warl_demonic_circle_summon::HandleRemove(), spell_putricide_eat_ooze::HandleScript(), AuraEffect::HandleShapeshiftBoosts(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_jaraxxus::boss_jaraxxusAI::JustEngagedWith(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::JustEngagedWith(), npc_ulduar_snow_mound::MoveInLineOfSight(), spell_blood_queen_vampiric_bite::OnCast(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), npc_essence_of_twin::OnGossipHello(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), npc_thrall_bfu::OnQuestReward(), npc_vortex_ride::npc_vortex_rideAI::PassengerBoarded(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), BattlefieldWG::PromotePlayer(), RemoveAppliedAuras(), RemoveAppliedAuras(), RemoveAreaAurasDueToLeaveWorld(), RemoveAura(), RemoveAura(), RemoveAura(), RemoveAurasByShapeShift(), RemoveAurasByType(), RemoveAurasDueToItemSpell(), RemoveAurasDueToSpell(), RemoveAurasWithAttribute(), RemoveAurasWithFamily(), RemoveAurasWithInterruptFlags(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), BattlegroundIC::RemovePlayer(), BattlegroundMap::RemovePlayerFromMap(), boss_bjarngrim::boss_bjarngrimAI::RemoveStanceAura(), boss_gyth::boss_gythAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_marli::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), NPCStaveQuestAI::ResetState(), boss_anomalus::SetData(), boss_hodir::boss_hodirAI::SmallIcicles(), boss_malygos::boss_malygosAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), boss_headless_horseman::SpellHit(), boss_viscidus::SpellHit(), spell_pal_hand_of_sacrifice_aura::Split(), boss_sartharion_shadron::boss_sartharion_shadronAI::SummonedCreatureDies(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_viscidus::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), Spell::UpdateChanneledTargetList(), and boss_bjarngrim::boss_bjarngrimAI::WaypointReached().

◆ RemoveAura() [4/4]

void Unit::RemoveAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4790{
4791 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4792 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4793 {
4794 Aura const* aura = iter->second->GetBase();
4795 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4796 && (!caster || aura->GetCasterGUID() == caster))
4797 {
4798 RemoveAura(iter, removeMode);
4799 return;
4800 }
4801 else
4802 ++iter;
4803 }
4804}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

◆ RemoveAuraFromStack()

void Unit::RemoveAuraFromStack ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4926{
4927 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4928 for (AuraMap::iterator iter = range.first; iter != range.second;)
4929 {
4930 Aura* aura = iter->second;
4931 if ((aura->GetType() == UNIT_AURA_TYPE)
4932 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4933 {
4934 aura->ModStackAmount(-1, removeMode);
4935 return;
4936 }
4937 else
4938 ++iter;
4939 }
4940}
@ UNIT_AURA_TYPE
Definition SpellAuraDefines.h:385
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition SpellAuras.cpp:1021
AuraObjectType GetType() const
Definition SpellAuras.cpp:481

References Aura::GetCasterGUID(), Aura::GetType(), m_ownedAuras, Aura::ModStackAmount(), and UNIT_AURA_TYPE.

Referenced by Spell::EffectSchoolDMG(), HandleAuraProc(), HandleDummyAuraProc(), spell_putricide_gaseous_bloat_aura::HandleExtraEffect(), spell_oculus_evasive_maneuvers_aura::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_item_brittle_armor::HandleScript(), spell_item_mercurial_shield::HandleScript(), boss_selin_fireheart::JustEngagedWith(), and boss_viscidus::SpellHit().

◆ RemoveAurasByShapeShift()

void Unit::RemoveAurasByShapeShift ( )
5271{
5272 uint32 mechanic_mask = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
5273 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5274 {
5275 Aura const* aura = iter->second->GetBase();
5276 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) &&
5278 {
5279 RemoveAura(iter);
5280 continue;
5281 }
5282 ++iter;
5283 }
5284}
@ SPELL_ATTR0_CU_AURA_CC
Definition SpellInfo.h:181
uint32 GetAllEffectsMechanicMask() const
Definition SpellInfo.cpp:1992

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), m_appliedAuras, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), SPELL_ATTR0_CU_AURA_CC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::HandleAuraModShapeshift().

◆ RemoveAurasByType()

void Unit::RemoveAurasByType ( AuraType  auraType,
ObjectGuid  casterGUID = ObjectGuid::Empty,
Aura except = nullptr,
bool  negative = true,
bool  positive = true 
)
5111{
5112 // simple check if list is empty
5113 if (m_modAuras[auraType].empty())
5114 return;
5115
5116 for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
5117 {
5118 Aura* aura = (*iter)->GetBase();
5120
5121 ++iter;
5122 if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5123 && ((negative && !aurApp->IsPositive()) || (positive && aurApp->IsPositive())))
5124 {
5125 uint32 removedAuras = m_removedAurasCount;
5126 RemoveAura(aurApp);
5127 if (m_removedAurasCount > removedAuras + 1)
5128 iter = m_modAuras[auraType].begin();
5129 }
5130 }
5131}

References Aura::GetApplicationOfTarget(), Aura::GetCasterGUID(), Object::GetGUID(), AuraApplication::IsPositive(), m_modAuras, m_removedAurasCount, and RemoveAura().

Referenced by _EnterVehicle(), Spell::_handle_finish_phase(), Player::ActivateTaxiPathTo(), Battleground::AddPlayer(), Attack(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::BeforeSpellClick(), spell_gen_summon_tournament_mount::CheckIfLanceEquipped(), ClearComboPoints(), Player::ContinueTaxiFlight(), boss_kologarn_arms::boss_kologarn_armsAI::DamageTaken(), Spell::DoSpellHitOnUnit(), Spell::EffectPowerBurn(), Spell::EffectTriggerSpell(), BattlegroundWS::EventPlayerClickedOnFlag(), ExitVehicle(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModStateImmunity(), AuraEffect::HandleAuraMounted(), AuraEffect::HandleAuraTransform(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), HandleDummyAuraProc(), spell_rog_vanish::HandleEffect(), spell_hydross_mark_of_hydross::HandleEffectApply(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleListStabledPetsOpcode(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), WorldSession::HandleMoveWorldportAck(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_algalon_remove_phase_aura::HandlePeriodic(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSaveGuildEmblemOpcode(), spell_gen_mine_sweeper::HandleSchoolDMG(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::HandleUnstablePet(), boss_gurtogg_bloodboil::JustEngagedWith(), Player::LeaveBattleground(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), spell_gen_aura_service_uniform::OnApply(), Player::ProcessDelayedOperations(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Vehicle::RemoveAllPassengers(), RemoveBindSightAuras(), RemoveCharmAuras(), Battleground::RemovePlayerAtLeave(), WorldSession::SendDoFlight(), WorldSession::SendListInventory(), Player::SendLoot(), WorldSession::SendTrainerList(), SetCharmedBy(), Player::StopCastingCharm(), Player::TeleportTo(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), GameObject::Use(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ RemoveAurasDueToItemSpell()

void Unit::RemoveAurasDueToItemSpell ( uint32  spellId,
ObjectGuid  castItemGuid 
)
5086{
5087 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5088 {
5089 if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
5090 {
5091 RemoveAura(iter);
5092 iter = m_appliedAuras.lower_bound(spellId);
5093 }
5094 else
5095 ++iter;
5096 }
5097
5098 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
5099 {
5100 if (iter->second->GetCastItemGUID() == castItemGuid)
5101 {
5103 iter = m_ownedAuras.lower_bound(spellId);
5104 }
5105 else
5106 ++iter;
5107 }
5108}

References AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, RemoveAura(), and RemoveOwnedAura().

Referenced by Player::ApplyEnchantment(), and Player::ApplyEquipSpell().

◆ RemoveAurasDueToSpell()

void Unit::RemoveAurasDueToSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4910{
4911 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4912 {
4913 Aura const* aura = iter->second->GetBase();
4914 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4915 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4916 {
4917 RemoveAura(iter, removeMode);
4918 iter = m_appliedAuras.lower_bound(spellId);
4919 }
4920 else
4921 ++iter;
4922 }
4923}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

Referenced by Spell::_cast(), Player::_removeTalentAurasAndSpells(), Player::ActivateSpec(), Vehicle::AddPassenger(), spell_commander_sarannis_arcane_devastation::AfterApply(), spell_dru_feral_swiftness::AfterRemove(), spell_dru_barkskin::AfterRemove(), spell_dru_savage_roar_aura::AfterRemove(), spell_dru_survival_instincts_aura::AfterRemove(), Player::ApplyEquipSpell(), boss_hakkar::boss_hakkarAI::ApplyHakkarPowerStacks(), boss_buru::ChaseNewVictim(), spell_eredar_twins_handle_touch::CheckCast(), boss_volazj::CheckPhaseMinions(), spell_botanica_shift_form_aura::CheckProc(), spell_mage_burning_determination::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), Player::CleanupAfterTaxiFlight(), AuraEffect::CleanupTriggeredSpells(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), spell_ruby_sanctum_rallying_shout::CountAllies(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_buru::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_leotheras_the_blind::DemonTime(), Player::DestroyItem(), WorldState::DispelAdalsSongOfBattle(), WorldState::DispelMagtheridonTeam(), npc_drakonid_spawner::DoAction(), npc_twilight_volunteer::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_frozen_core::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::DoAction(), npc_maiev_illidan::DoAction(), npc_pet_gen_argent_pony_bridle::DoAction(), boss_alar::DoDiveBomb(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), Spell::DoTriggersOnSpellHit(), Spell::EffectApplyGlyph(), Spell::EffectHeal(), Spell::EffectRemoveAura(), Spell::EffectSchoolDMG(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_zuljin::EnterPhase(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), BattleExperienceEvent::Execute(), SendEncounterUnit::Execute(), FrostBombExplosion::Execute(), AuraRemoveEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), spell_sindragosa_ice_tomb_trap_aura::ExtraRemoveEffect(), spell_mother_shahraz_fatal_attraction_dummy::FilterTargets(), spell_warr_improved_spell_reflection_trigger::FilterTargets(), lfg::LFGMgr::FinishDungeon(), spell_dru_berserk::HandleAfterCast(), spell_capacitus_polarity_charge_aura::HandleAfterRemove(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_moroes_vanish::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_warhead_detonate::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), HandleDummyAuraProc(), spell_magtheridon_shadow_grasp_visual::HandleDummyRemove(), spell_shadowfang_keep_forsaken_skills_aura::HandleDummyTick(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_q12730_quenching_mist::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectRemove(), spell_serpentshrine_cavern_coilfang_water::HandleEffectRemove(), spell_q10769_dissension_amongst_the_ranks_aura::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), spell_midsummer_fling_torch::HandleFinish(), gm_commandscript::HandleGMVisibleCommand(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), spell_transitus_shield_beam_aura::HandleOnEffectRemove(), OPvPCapturePointZM_GraveYard::HandleOpenGo(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_algalon_remove_phase_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), OutdoorPvPNA::HandlePlayerLeaveZone(), OutdoorPvPSI::HandlePlayerLeaveZone(), OutdoorPvPTF::HandlePlayerLeaveZone(), OutdoorPvPZM::HandlePlayerLeaveZone(), WorldState::HandlePlayerLeaveZone(), spell_gen_consume::HandleProc(), spell_pri_t4_4p_bonus::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), HandleProcTriggerSpell(), spell_icc_harvest_blight_specimen::HandleQuestComplete(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleRemove(), spell_dru_enrage::HandleRemove(), spell_pal_divine_intervention::HandleRemove(), spell_pal_avenging_wrath::HandleRemove(), spell_rog_killing_spree_aura::HandleRemove(), spell_warr_vigilance::HandleRemove(), WorldSession::HandleRemoveGlyph(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_putricide_clear_aura_effect_value::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_jump_remove_aura::HandleScript(), spell_icc_harvest_blight_specimen::HandleScript(), spell_festergut_pungent_blight::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_q10651_q10692_book_of_fel_names::HandleScript(), spell_halion_clear_debuffs::HandleScriptEffect(), spell_q12823_remove_collapsing_cave_aura::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), spell_capacitus_polarity_charge::HandleTargets(), misc_commandscript::HandleUnAuraCommand(), misc_commandscript::HandleUnFreezeCommand(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), npc_underbog_mushroom::InitializeAI(), npc_demon_chain::JustDied(), boss_azuregos::boss_azuregosAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_zuljin::JustEngagedWith(), boss_bronjahm::boss_bronjahmAI::JustEngagedWith(), boss_doomwalker::JustEngagedWith(), boss_gruul::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_buru::JustEngagedWith(), boss_gal_darah::boss_gal_darahAI::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_hydross_the_unstable::JustReachedHome(), boss_felblood_kaelthas::LapseAction(), boss_garfrost::boss_garfrostAI::MovementInform(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::MovementInform(), boss_felmyst::MovementInform(), boss_shade_of_akama::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), spell_halion_twilight_realm_aura::OnApply(), spell_halion_leave_twilight_realm_aura::OnApply(), spell_systems_shutdown_aura::OnApply(), npc_chesspiece::OnCharmed(), npc_eye_of_acherus::OnCharmed(), npc_aged_dying_ancient_kodo::OnGossipHello(), lfg::LFGPlayerScript::OnMapChanged(), spell_claw_rage_aura::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), spell_gen_curse_of_pain::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), BattlefieldWG::OnPlayerLeaveZone(), boss_shade_of_aran::OnPowerUpdate(), spell_halion_combustion_consumption_aura::OnRemove(), spell_halion_leave_twilight_realm_aura::OnRemove(), spell_algalon_phase_punch_aura::OnRemove(), spell_load_into_catapult_aura::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_hun_ascpect_of_the_viper::OnRemove(), spell_hun_viper_attack_speed::OnRemove(), spell_item_with_mount_speed::OnRemove(), spell_item_desperate_defense::OnRemove(), spell_item_shadowmourne::OnRemove(), spell_item_shadowmourne_soul_fragment::OnRemove(), spell_mage_combustion_proc::OnRemove(), spell_item_shadowmourne_soul_fragment::OnStackChange(), MidsummerPlayerScript::OnUpdateZone(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::PassengerBoarded(), boss_jeklik::PathEndReached(), spell_quest_test_flight_charging::PerformKick(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), spell_gen_defend::RefreshVisualShields(), RemoveAurasDueToSpellByDispel(), BattlefieldWG::RemoveAurasFromPlayer(), boss_festergut::boss_festergutAI::RemoveBlight(), spell_warl_health_funnel::RemoveEffect(), RemoveGameObject(), BattlegroundAV::RemovePlayer(), Battleground::RemovePlayerFromResurrectQueue(), boss_keristrasza::RemovePrison(), Pet::removeSpell(), Player::removeSpell(), spell_gen_eject_all_passengers::RemoveVehicleAuras(), spell_gen_defend::RemoveVisualShields(), boss_malchezaar::Reset(), npc_mograine::npc_mograineAI::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), npc_singularity::Reset(), boss_twilight_corrupter::Reset(), boss_nalorakk::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_thekal::Reset(), boss_cthun::Reset(), boss_viscidus::Reset(), boss_halion::boss_halionAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_leotheras_the_blind::Reset(), boss_lethon::boss_lethonAI::Reset(), boss_taerar::boss_taerarAI::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), Player::ResurrectPlayer(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_magtheridon::ScheduleCombatEvents(), boss_supremus::SchedulePhase(), boss_laj::ScheduleTasks(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), OPvPCapturePointZM_GraveYard::SetBeaconState(), boss_hydross_the_unstable::SetForm(), Player::SetGMVisible(), boss_mandokir::boss_mandokirAI::SetGUID(), Player::SetIsSpectator(), SetModelVisible(), npc_akama_shade::sGossipSelect(), boss_viscidus::SoftReset(), boss_ossirian::SpellHit(), npc_omen::npc_omenAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), advisor_baseAI::SpellHit(), boss_moorabi::boss_moorabiAI::SpellHitTarget(), boss_festergut::boss_festergutAI::SpellHitTarget(), boss_ahune::Submerge(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_cthun::SummonedCreatureDies(), npc_kiljaeden_controller::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), boss_anzu::SummonedCreatureDies(), boss_viscidus::SummonedCreatureDies(), boss_terestian_illhoof::SummonKilrek(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_netherspite::SwitchToBanishPhase(), boss_netherspite::SwitchToPortalPhase(), Totem::UnSummon(), spell_black_temple_spell_absorption_aura::Update(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_moam::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_anzu::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_darting_hatchling::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ RemoveAurasDueToSpellByDispel()

void Unit::RemoveAurasDueToSpellByDispel ( uint32  spellId,
uint32  dispellerSpellId,
ObjectGuid  casterGUID,
Unit dispeller,
uint8  chargesRemoved = 1 
)
4943{
4944 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4945 for (AuraMap::iterator iter = range.first; iter != range.second;)
4946 {
4947 Aura* aura = iter->second;
4948 if (aura->GetCasterGUID() == casterGUID)
4949 {
4950 DispelInfo dispelInfo(dispeller, dispellerSpellId, chargesRemoved);
4951
4952 // Call OnDispel hook on AuraScript
4953 aura->CallScriptDispel(&dispelInfo);
4954
4956 aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
4957 else
4958 aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
4959
4960 // Call AfterDispel hook on AuraScript
4961 aura->CallScriptAfterDispel(&dispelInfo);
4962
4963 switch (aura->GetSpellInfo()->SpellFamilyName)
4964 {
4965 case SPELLFAMILY_HUNTER:
4966 {
4967 // Noxious Stings
4968 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000)
4969 {
4970 if (Unit* caster = aura->GetCaster())
4971 {
4972 if (AuraEffect* aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1))
4973 {
4974 if (Aura* noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster))
4975 {
4976 noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100);
4977 if (aura->GetUnitOwner())
4978 if (const std::vector<int32>* spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId())))
4979 for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
4980 aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr);
4981 }
4982 }
4983 }
4984 }
4985 break;
4986 }
4988 {
4989 // Icy Clutch, remove with Frost Fever
4990 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000)
4991 {
4992 if (AuraEffect* aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID))
4993 RemoveAurasDueToSpell(aureff->GetId());
4994 }
4995 }
4996 default:
4997 break;
4998 }
4999 return;
5000 }
5001 else
5002 ++iter;
5003 }
5004}
void CallScriptDispel(DispelInfo *dispelInfo)
Definition SpellAuras.cpp:2390
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition SpellAuras.cpp:352
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition SpellAuras.cpp:973
void CallScriptAfterDispel(DispelInfo *dispelInfo)
Definition SpellAuras.cpp:2403
Definition Unit.h:296

References AURA_REMOVE_BY_ENEMY_SPELL, Aura::CallScriptAfterDispel(), Aura::CallScriptDispel(), GetAuraEffect(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetDuration(), Aura::GetEffectMask(), Aura::GetId(), DispelInfo::GetRemovedCharges(), Aura::GetSpellInfo(), Aura::GetUnitOwner(), SpellInfo::HasAttribute(), m_ownedAuras, Aura::ModCharges(), Aura::ModStackAmount(), RemoveAurasDueToSpell(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Aura::TryCreate().

Referenced by Spell::EffectDispel().

◆ RemoveAurasDueToSpellBySteal()

void Unit::RemoveAurasDueToSpellBySteal ( uint32  spellId,
ObjectGuid  casterGUID,
Unit stealer 
)
5007{
5008 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5009 for (AuraMap::iterator iter = range.first; iter != range.second;)
5010 {
5011 Aura* aura = iter->second;
5012 if (aura->GetCasterGUID() == casterGUID)
5013 {
5014 int32 damage[MAX_SPELL_EFFECTS];
5015 int32 baseDamage[MAX_SPELL_EFFECTS];
5016 uint8 effMask = 0;
5017 uint8 recalculateMask = 0;
5018 Unit* caster = aura->GetCaster();
5019 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5020 {
5021 if (aura->GetEffect(i))
5022 {
5023 baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
5024 damage[i] = aura->GetEffect(i)->GetAmount();
5025 effMask |= (1 << i);
5026 if (aura->GetEffect(i)->CanBeRecalculated())
5027 recalculateMask |= (1 << i);
5028 }
5029 else
5030 {
5031 baseDamage[i] = 0;
5032 damage[i] = 0;
5033 }
5034 }
5035
5037 // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
5038 uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
5039
5040 if (Aura* oldAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
5041 {
5042 if (stealCharge)
5043 oldAura->ModCharges(1);
5044 else
5045 oldAura->ModStackAmount(1);
5046 oldAura->SetDuration(int32(dur));
5047 }
5048 else
5049 {
5050 // single target state must be removed before aura creation to preserve existing single target aura
5051 if (aura->IsSingleTarget())
5052 aura->UnregisterSingleTarget();
5053
5054 // Xinef: if stealer has same aura
5055 Aura* curAura = stealer->GetAura(aura->GetId());
5056 if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur))
5057 if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, nullptr, &baseDamage[0], nullptr, aura->GetCasterGUID()))
5058 {
5059 // created aura must not be single target aura,, so stealer won't loose it on recast
5060 if (newAura->IsSingleTarget())
5061 {
5062 newAura->UnregisterSingleTarget();
5063 // bring back single target aura status to the old aura
5064 aura->SetIsSingleTarget(true);
5065 caster->GetSingleCastAuras().push_back(aura);
5066 }
5067 // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
5068 newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
5069 newAura->ApplyForTargets();
5070 }
5071 }
5072
5073 if (stealCharge)
5075 else
5077
5078 return;
5079 }
5080 else
5081 ++iter;
5082 }
5083}
bool CanBeRecalculated() const
Definition SpellAuraEffects.h:78
int32 GetBaseAmount() const
Definition SpellAuraEffects.h:57
void UnregisterSingleTarget()
Definition SpellAuras.cpp:1167
bool IsPermanent() const
Definition SpellAuras.h:139

References AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::CanBeRecalculated(), AuraEffect::GetAmount(), GetAura(), AuraEffect::GetBaseAmount(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetCharges(), Aura::GetDuration(), Aura::GetEffect(), Aura::GetId(), Aura::GetMaxDuration(), GetSingleCastAuras(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), IN_MILLISECONDS, Aura::IsPermanent(), Aura::IsSingleTarget(), m_ownedAuras, MAX_SPELL_EFFECTS, MINUTE, Aura::ModCharges(), Aura::ModStackAmount(), Aura::SetIsSingleTarget(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, Aura::TryRefreshStackOrCreate(), and Aura::UnregisterSingleTarget().

Referenced by Spell::EffectStealBeneficialBuff().

◆ RemoveAurasWithAttribute()

void Unit::RemoveAurasWithAttribute ( uint32  flags)
5134{
5135 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5136 {
5137 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
5138 if (spell->Attributes & flags)
5139 RemoveAura(iter);
5140 else
5141 ++iter;
5142 }
5143}

References SpellInfo::Attributes, flags, m_appliedAuras, and RemoveAura().

◆ RemoveAurasWithFamily()

void Unit::RemoveAurasWithFamily ( SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID 
)
5217{
5218 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5219 {
5220 Aura const* aura = iter->second->GetBase();
5221 if (!casterGUID || aura->GetCasterGUID() == casterGUID)
5222 {
5223 SpellInfo const* spell = aura->GetSpellInfo();
5224 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5225 {
5226 RemoveAura(iter);
5227 continue;
5228 }
5229 }
5230 ++iter;
5231 }
5232}

References Aura::GetCasterGUID(), Aura::GetSpellInfo(), flag96::HasFlag(), m_appliedAuras, RemoveAura(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by spell_warl_demonic_aegis::HandleAuraApply(), and Aura::HandleAuraSpecificMods().

◆ RemoveAurasWithInterruptFlags()

void Unit::RemoveAurasWithInterruptFlags ( uint32  flag,
uint32  except = 0,
bool  isAutoshot = false 
)
5182{
5183 if (!(m_interruptMask & flag))
5184 return;
5185
5186 // interrupt auras
5187 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end();)
5188 {
5189 Aura* aura = (*iter)->GetBase();
5190 ++iter;
5191 if ((aura->GetSpellInfo()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
5192 {
5193 uint32 removedAuras = m_removedAurasCount;
5194 RemoveAura(aura);
5195 if (m_removedAurasCount > removedAuras + 1)
5196 iter = m_interruptableAuras.begin();
5197 }
5198 }
5199
5200 // interrupt channeled spell
5202 {
5203 if (spell->getState() == SPELL_STATE_CASTING && (spell->m_spellInfo->ChannelInterruptFlags & flag) && spell->m_spellInfo->Id != except)
5204 {
5205 // Do not interrupt if auto shot
5206 if (!(isAutoshot && spell->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS)))
5207 {
5208 InterruptNonMeleeSpells(false, spell->m_spellInfo->Id);
5209 }
5210 }
5211 }
5212
5214}

References SpellInfo::AuraInterruptFlags, CURRENT_CHANNELED_SPELL, Aura::GetId(), Aura::GetSpellInfo(), InterruptNonMeleeSpells(), m_currentSpells, m_interruptableAuras, m_interruptMask, m_removedAurasCount, RemoveAura(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_CASTING, and UpdateInterruptMask().

Referenced by _EnterVehicle(), AttackerStateUpdate(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealDamage(), Dismount(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), spell_rog_killing_spree::FilterTargets(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModStealth(), AuraEffect::HandleModUnattackable(), WorldSession::HandleMovementOpcodes(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePhase(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), Mount(), Spell::prepare(), ProcessTerrainStatusUpdate(), Player::SetInWater(), SetStandState(), Player::TeleportTo(), and UpdatePosition().

◆ RemoveAurasWithMechanic()

void Unit::RemoveAurasWithMechanic ( uint32  mechanic_mask,
AuraRemoveMode  removemode = AURA_REMOVE_BY_DEFAULT,
uint32  except = 0 
)
5254{
5255 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5256 {
5257 Aura const* aura = iter->second->GetBase();
5258 if (!except || aura->GetId() != except)
5259 {
5260 if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask)
5261 {
5262 RemoveAura(iter, removemode);
5263 continue;
5264 }
5265 }
5266 ++iter;
5267 }
5268}

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetId(), Aura::GetSpellInfo(), m_appliedAuras, and RemoveAura().

Referenced by HandleDummyAuraProc(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), spell_rog_vanish_purge::HandleRootRemove(), spell_rog_vanish_purge::HandleSnareRemove(), and RemoveMovementImpairingAuras().

◆ RemoveBindSightAuras()

void Unit::RemoveBindSightAuras ( )
11216{
11218}
@ SPELL_AURA_BIND_SIGHT
Definition SpellAuraDefines.h:64

References RemoveAurasByType(), and SPELL_AURA_BIND_SIGHT.

Referenced by RemoveFromWorld().

◆ RemoveCharmAuras()

void Unit::RemoveCharmAuras ( )

◆ RemoveCharmedBy()

void Unit::RemoveCharmedBy ( Unit charmer)
18576{
18577 if (!IsCharmed())
18578 return;
18579
18580 if (!charmer)
18581 charmer = GetCharmer();
18582 if (charmer != GetCharmer()) // one aura overrides another?
18583 {
18584 // LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: {} true charmer: {} false charmer: {}",
18585 // GetGUID().ToString(), GetCharmerGUID().ToString(), charmer->GetGUID().ToString());
18586 // ABORT();
18587 return;
18588 }
18589
18590 CharmType type;
18592 type = CHARM_TYPE_POSSESS;
18593 else if (charmer && charmer->IsOnVehicle(this))
18594 type = CHARM_TYPE_VEHICLE;
18595 else
18596 type = CHARM_TYPE_CHARM;
18597
18598 if (_oldFactionId)
18599 {
18601 _oldFactionId = 0;
18602 }
18603 else
18605
18606 CastStop();
18607 AttackStop();
18608
18609 // xinef: update speed after charming
18610 UpdateSpeed(MOVE_RUN, false);
18611
18612 // xinef: do not break any controlled motion slot
18613 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
18614 {
18615 StopMoving();
18617 }
18618 // xinef: if we have any controlled movement, clear active and idle only
18619 else
18621
18623
18624 // xinef: remove stunned flag if owner was mounted
18627
18628 // If charmer still exists
18629 if (!charmer)
18630 return;
18631
18632 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
18633 ASSERT(type != CHARM_TYPE_VEHICLE || (IsCreature() && IsVehicle()));
18634
18635 charmer->SetCharm(this, false);
18636
18638
18639 Player* playerCharmer = charmer->ToPlayer();
18640 if (playerCharmer)
18641 {
18642 switch (type)
18643 {
18644 case CHARM_TYPE_VEHICLE:
18645 playerCharmer->SetClientControl(this, false);
18646 playerCharmer->SetClientControl(charmer, true); // verified
18649 break;
18650 case CHARM_TYPE_POSSESS:
18651 playerCharmer->SetClientControl(this, false);
18652 playerCharmer->SetClientControl(charmer, true); // verified
18657 break;
18658 case CHARM_TYPE_CHARM:
18660 {
18662 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
18663 {
18665 if (GetCharmInfo())
18666 GetCharmInfo()->SetPetNumber(0, true);
18667 else
18668 LOG_ERROR("entities.unit", "Aura::HandleModCharm: target={} has a charm aura but no charm info!", GetGUID().ToString());
18669 }
18670 }
18671 break;
18672 default:
18673 break;
18674 }
18675 }
18676
18677 if (Player* player = ToPlayer())
18678 {
18679 sScriptMgr->AnticheatSetUnderACKmount(player);
18680 }
18681
18682 // xinef: restore threat
18683 for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr)
18684 {
18685 if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first))
18686 if (!IsFriendlyTo(target))
18687 AddThreat(target, itr->second);
18688 }
18689
18690 _charmThreatInfo.clear();
18691
18692 if (Creature* creature = ToCreature())
18693 {
18694 // Vehicle should not attack its passenger after he exists the seat
18695 if (type != CHARM_TYPE_VEHICLE && charmer->IsAlive() && !charmer->IsFriendlyTo(creature))
18696 if (Attack(charmer, true))
18697 GetMotionMaster()->MoveChase(charmer);
18698
18699 // Creature will restore its old AI on next update
18700 if (creature->AI())
18701 creature->AI()->OnCharmed(false);
18702
18703 // Xinef: Remove movement flag flying
18705 }
18706 else
18707 ToPlayer()->SetClientControl(this, true); // verified
18708
18709 // a guardian should always have charminfo
18710 if (playerCharmer && this != charmer->GetFirstControlled())
18711 playerCharmer->SendRemoveControlBar();
18712
18713 // xinef: Always delete charm info (restores react state)
18714 if (IsPlayer() || (IsCreature() && !ToCreature()->IsGuardian()))
18716}
CharmType
Definition CharmInfo.h:44
@ CHARM_TYPE_CHARM
Definition CharmInfo.h:45
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:46
@ CHARM_TYPE_VEHICLE
Definition CharmInfo.h:47
@ MOTION_SLOT_CONTROLLED
Definition MotionMaster.h:65
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:64
@ NULL_MOTION_TYPE
Definition MotionMaster.h:58
@ CREATURE_TYPE_DEMON
Definition SharedDefines.h:2630
@ CLASS_CONTEXT_PET_CHARM
Definition UnitDefines.h:237
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition UnitDefines.h:198
@ MOVE_RUN
Definition UnitDefines.h:350
@ UNIT_FLAG_DISABLE_MOVE
Definition UnitDefines.h:252
void InitDefault()
Definition MotionMaster.cpp:87
void MovementExpiredOnSlot(MovementSlot slot, bool reset=true)
Definition MotionMaster.h:194
void MovementExpired(bool reset=true)
Definition MotionMaster.h:180
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:750
void SendRemoveControlBar()
Definition Player.cpp:9729
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition Player.cpp:12890
void DeleteCharmInfo()
Definition Unit.cpp:15842
void RestoreFaction()
Definition Unit.cpp:18718
void SetCharm(Unit *target, bool apply)
Definition Unit.cpp:10899
void StopAttackingInvalidTarget()
Definition Unit.cpp:20226
void CastStop(uint32 except_spellid=0, bool withInstant=true)
Interrupt the unit cast for all the current spells.
Definition Unit.cpp:1160
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:10295
CharmThreatMap _charmThreatInfo
Definition Unit.h:2107
void RemoveUnitMovementFlag(uint32 f)
Definition Unit.h:741
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition Unit.cpp:14273
uint32 unit_class
Definition CreatureData.h:213

References _charmThreatInfo, _oldFactionId, AddThreat(), ASSERT, Attack(), AttackStop(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, CLASS_CONTEXT_PET_CHARM, CLASS_WARLOCK, ClearUnitState(), CREATURE_TYPE_DEMON, DeleteCharmInfo(), GetCharmer(), GetCharmInfo(), Creature::GetCreatureTemplate(), GetFirstControlled(), Object::GetGUID(), GetMotionMaster(), ObjectAccessor::GetUnit(), HasUnitState(), MotionMaster::InitDefault(), IsAlive(), IsCharmed(), IsClass(), Object::IsCreature(), IsFriendlyTo(), IsGuardian(), IsOnVehicle(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MOTION_SLOT_ACTIVE, MOTION_SLOT_CONTROLLED, MOVE_RUN, MotionMaster::MoveChase(), MotionMaster::MovementExpired(), MotionMaster::MovementExpiredOnSlot(), MOVEMENTFLAG_FLYING, NULL_MOTION_TYPE, RemoveUnitFlag(), RemoveUnitMovementFlag(), RestoreFaction(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), sScriptMgr, StopAttackingInvalidTarget(), StopMoving(), Object::ToCreature(), Object::ToPlayer(), Position::ToString(), CreatureTemplate::type, CreatureTemplate::unit_class, UNIT_FIELD_BYTES_0, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_FLAG_STUNNED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, UNIT_STATE_STUNNED, and UpdateSpeed().

Referenced by AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), npc_chesspiece::JustDied(), Puppet::RemoveFromWorld(), Vehicle::RemovePassenger(), and npc_chesspiece::sGossipSelect().

◆ RemoveComboPointHolder()

void Unit::RemoveComboPointHolder ( Unit unit)
inline
974{ m_ComboPointHolders.erase(unit); }

References m_ComboPointHolders.

Referenced by AddComboPoints(), and ClearComboPoints().

◆ RemoveDynObject()

bool Unit::RemoveDynObject ( uint32  spellId)
6165{
6166 if (m_dynObj.empty())
6167 return false;
6168
6169 bool result = false;
6170 for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
6171 {
6172 DynamicObject* dynObj = *i;
6173 if (dynObj->GetSpellId() == spellId)
6174 {
6175 dynObj->Remove();
6176 i = m_dynObj.begin();
6177 result = true;
6178 }
6179 else
6180 ++i;
6181 }
6182
6183 return result;
6184}
void Remove()
Definition DynamicObject.cpp:185

References DynamicObject::GetSpellId(), m_dynObj, and DynamicObject::Remove().

Referenced by Spell::cancel(), Spell::EffectAddFarsight(), and spell_item_shifting_naaru_silver::OnBaseRemove().

◆ RemoveEvadeAuras()

void Unit::RemoveEvadeAuras ( )
5438{
5439 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5440 {
5441 Aura const* aura = iter->second->GetBase();
5442 SpellInfo const* spellInfo = aura->GetSpellInfo();
5444 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5445 ++iter;
5446 else
5448 }
5449
5450 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5451 {
5452 Aura* aura = iter->second;
5453 SpellInfo const* spellInfo = aura->GetSpellInfo();
5455 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5456 ++iter;
5457 else
5459 }
5460}
@ SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT
Definition SharedDefines.h:444
@ SPELL_ATTR0_CU_IGNORE_EVADE
Definition SpellInfo.h:187

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, GetOwnerGUID(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), Aura::IsPassive(), ObjectGuid::IsPlayer(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CLONE_CASTER, and SPELL_AURA_CONTROL_VEHICLE.

Referenced by CreatureAI::_EnterEvadeMode(), and npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode().

◆ RemoveExtraUnitMovementFlag()

void Unit::RemoveExtraUnitMovementFlag ( uint16  f)
inline

◆ removeFollower()

void Unit::removeFollower ( FollowerReference )
inline
1805{ /* nothing to do yet */ }

Referenced by FollowerReference::targetObjectDestroyLink().

◆ RemoveFromWorld()

void Unit::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

15720{
15721 // cleanup
15722 ASSERT(GetGUID());
15723
15724 if (IsInWorld())
15725 {
15727 if (IsVehicle())
15729
15733
15736
15737 ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
15740
15742
15743 if (GetCharmerGUID())
15744 {
15745 LOG_FATAL("entities.unit", "Unit {} has charmer guid when removed from world", GetEntry());
15746 ABORT();
15747 }
15748
15749 if (Unit* owner = GetOwner())
15750 {
15751 if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
15752 {
15754 owner->SetMinion((Minion*)this, false);
15755 LOG_INFO("entities.unit", "Unit {} is in controlled list of {} when removed from world", GetEntry(), owner->GetEntry());
15756 //ABORT();
15757 }
15758 }
15759
15762 }
15763}
void RemoveNotOwnSingleTargetAuras()
Definition Unit.cpp:5145
void UnsummonAllTotems(bool onDeath=false)
Definition Unit.cpp:11228
void RemoveAllDynObjects()
Definition Unit.cpp:6186
void RemoveAreaAurasDueToLeaveWorld()
Definition Unit.cpp:5286
void RemoveBindSightAuras()
Definition Unit.cpp:11215
void RemoveAllControlled(bool onDeath=false)
Definition Unit.cpp:11109
void RemoveFromWorld() override
Definition Object.cpp:1193

References ABORT, ASSERT, ExitVehicle(), GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwner(), HasUnitTypeMask(), Object::IsInWorld(), IsVehicle(), LOG_FATAL, LOG_INFO, m_duringRemoveFromWorld, RemoveAllControlled(), RemoveAllDynObjects(), RemoveAllGameObjects(), RemoveAreaAurasDueToLeaveWorld(), RemoveBindSightAuras(), RemoveCharmAuras(), WorldObject::RemoveFromWorld(), RemoveNotOwnSingleTargetAuras(), RemoveVehicleKit(), UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UnsummonAllTotems().

Referenced by CleanupBeforeRemoveFromMap(), Creature::RemoveFromWorld(), Pet::RemoveFromWorld(), and Player::RemoveFromWorld().

◆ RemoveGameObject() [1/2]

void Unit::RemoveGameObject ( GameObject gameObj,
bool  del 
)
6221{
6222 if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
6223 return;
6224
6226
6227 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
6228 {
6229 if (m_ObjectSlot[i] == gameObj->GetGUID())
6230 {
6231 m_ObjectSlot[i].Clear();
6232 break;
6233 }
6234 }
6235
6236 // GO created by some spell
6237 if (uint32 spellid = gameObj->GetSpellId())
6238 {
6239 RemoveAurasDueToSpell(spellid);
6240
6241 if (IsPlayer())
6242 {
6243 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
6244 // Need activate spell use for owner
6245 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6246 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6247 ToPlayer()->SendCooldownEvent(createBySpell);
6248 }
6249 }
6250
6251 m_gameObj.remove(gameObj->GetGUID());
6252
6253 if (del)
6254 {
6255 gameObj->SetRespawnTime(0);
6256 gameObj->Delete();
6257 }
6258}
void Clear()
Definition ObjectGuid.h:138
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition Player.cpp:11140

References ObjectGuid::Clear(), GameObject::Delete(), ObjectGuid::Empty, Object::GetGUID(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, m_ObjectSlot, MAX_GAMEOBJECT_SLOT, RemoveAurasDueToSpell(), Player::SendCooldownEvent(), GameObject::SetOwnerGUID(), GameObject::SetRespawnTime(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::cancel(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), Spell::EffectSummonObject(), gobject_commandscript::HandleGameObjectDeleteCommand(), spell_warl_demonic_circle_summon::HandleRemove(), boss_kologarn::boss_kologarnAI::JustDied(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::JustDied(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), GameObject::Update(), and npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI().

◆ RemoveGameObject() [2/2]

void Unit::RemoveGameObject ( uint32  spellid,
bool  del 
)
6261{
6262 if (m_gameObj.empty())
6263 return;
6264
6265 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
6266 {
6267 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6268 {
6269 if (spellid > 0 && go->GetSpellId() != spellid)
6270 {
6271 ++itr;
6272 continue;
6273 }
6274
6275 go->SetOwnerGUID(ObjectGuid::Empty);
6276 if (del)
6277 {
6278 go->SetRespawnTime(0);
6279 go->Delete();
6280 }
6281 }
6282 m_gameObj.erase(itr++);
6283 }
6284}

References ObjectGuid::Empty, ObjectAccessor::GetGameObject(), and m_gameObj.

◆ removeHatedBy()

void Unit::removeHatedBy ( HostileReference )
inline
912{ /* nothing to do yet */ }

Referenced by HostileReference::targetObjectDestroyLink().

◆ RemoveMovementImpairingAuras()

void Unit::RemoveMovementImpairingAuras ( bool  withRoot)
5235{
5236 if (withRoot)
5238
5239 // Snares
5240 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5241 {
5242 Aura const* aura = iter->second->GetBase();
5244 {
5245 RemoveAura(iter);
5246 continue;
5247 }
5248
5249 ++iter;
5250 }
5251}
bool HasEffectMechanic(Mechanics mechanic) const
Definition SpellInfo.cpp:884

References Aura::GetSpellInfo(), SpellInfo::HasEffectMechanic(), m_appliedAuras, SpellInfo::Mechanic, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), and RemoveAurasWithMechanic().

Referenced by Spell::CheckCast(), Spell::EffectTriggerSpell(), HandleDummyAuraProc(), AuraEffect::HandleModMechanicImmunity(), and spell_gen_remove_impairing_auras::HandleScriptEffect().

◆ RemoveNotOwnSingleTargetAuras()

void Unit::RemoveNotOwnSingleTargetAuras ( )
5146{
5147 // single target auras from other casters
5148 // Iterate m_ownedAuras - aura is marked as single target in Unit::AddAura (and pushed to m_ownedAuras).
5149 // m_appliedAuras will NOT contain the aura before first Unit::Update after adding it to m_ownedAuras.
5150 // Quickly removing such an aura will lead to it not being unregistered from caster's single cast auras container
5151 // leading to assertion failures if the aura was cast on a player that can
5152 // (and is changing map at the point where this function is called).
5153 // Such situation occurs when player is logging in inside an instance and fails the entry check for any reason.
5154 // The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance
5155 // to register in m_appliedAuras
5156 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5157 {
5158 Aura const* aura = iter->second;
5159
5160 if (aura->GetCasterGUID() != GetGUID() && aura->IsSingleTarget())
5161 RemoveOwnedAura(iter);
5162 else
5163 ++iter;
5164 }
5165
5166 // single target auras at other targets
5167 AuraList& scAuras = GetSingleCastAuras();
5168 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
5169 {
5170 Aura* aura = *iter;
5171 if (aura->GetUnitOwner() != this)
5172 {
5173 aura->Remove();
5174 iter = scAuras.begin();
5175 }
5176 else
5177 ++iter;
5178 }
5179}

References Aura::GetCasterGUID(), Object::GetGUID(), GetSingleCastAuras(), Aura::GetUnitOwner(), Aura::IsSingleTarget(), m_ownedAuras, Aura::Remove(), and RemoveOwnedAura().

Referenced by RemoveFromWorld().

◆ RemoveNpcFlag()

void Unit::RemoveNpcFlag ( NPCFlags  flags)
inline

References flags, Object::RemoveFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_vaelastrasz::boss_vaelAI::BeginSpeech(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_fos_leader::npc_fos_leaderAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_akama_illidan::DoAction(), spell_q12096_q12092_dummy::HandleDummy(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), npc_precious::npc_preciousAI::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), npc_akama_illidan::JustReachedHome(), npc_fos_leader_second::npc_fos_leader_secondAI::npc_fos_leader_secondAI(), npc_pos_leader_second::npc_pos_leader_secondAI::npc_pos_leader_secondAI(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_announcer_toc10::OnGossipHello(), npc_hyjal_jaina::OnGossipSelect(), npc_hyjal_thrall::OnGossipSelect(), boss_doomrel::OnGossipSelect(), boss_majordomo::OnGossipSelect(), npc_zulaman_hostage::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_announcer_toc5::OnGossipSelect(), npc_announcer_toc10::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_hor_leader_second::OnGossipSelect(), npc_battle_at_valhalas::OnQuestAccept(), npc_riggle_bassbait::OnQuestReward(), NPCStaveQuestAI::PrepareForEncounter(), RemoveVehicleKit(), boss_majordomo::boss_majordomoAI::Reset(), npc_arthas::npc_arthasAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_lake_frog::npc_lake_frogAI::Reset(), npc_akama_illidan::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_magister_aledis::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::sGossipSelect(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::sGossipSelect(), boss_apothecary_hummel::boss_apothecary_hummelAI::sGossipSelect(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_harrison_jones::sGossipSelect(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_general_andorov::sGossipSelect(), npc_akama_shade::sGossipSelect(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_chesspiece::SpellHitTarget(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_magister_aledis::StartFight(), npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), and Vehicle::Vehicle().

◆ RemoveOwnedAura() [1/3]

void Unit::RemoveOwnedAura ( Aura aura,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4739{
4740 if (aura->IsRemoved())
4741 return;
4742
4743 ASSERT(aura->GetOwner() == this);
4744
4745 uint32 spellId = aura->GetId();
4746 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4747
4748 for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
4749 {
4750 if (itr->second == aura)
4751 {
4752 RemoveOwnedAura(itr, removeMode);
4753 return;
4754 }
4755 }
4756
4757 ABORT();
4758}

References ABORT, ASSERT, Aura::GetId(), Aura::GetOwner(), Aura::IsRemoved(), m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAura() [2/3]

void Unit::RemoveOwnedAura ( AuraMap::iterator &  i,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4706{
4707 Aura* aura = i->second;
4708 ASSERT(!aura->IsRemoved());
4709
4710 // if unit currently update aura list then make safe update iterator shift to next
4713
4714 m_ownedAuras.erase(i);
4715 m_removedAuras.push_back(aura);
4716
4717 // Unregister single target aura
4718 if (aura->IsSingleTarget())
4719 aura->UnregisterSingleTarget();
4720
4721 aura->_Remove(removeMode);
4722
4723 i = m_ownedAuras.begin();
4724}
void _Remove(AuraRemoveMode removeMode)
Definition SpellAuras.cpp:574

References Aura::_Remove(), ASSERT, Aura::IsRemoved(), Aura::IsSingleTarget(), m_auraUpdateIterator, m_ownedAuras, m_removedAuras, and Aura::UnregisterSingleTarget().

Referenced by Player::_removeTalentAurasAndSpells(), _UpdateSpells(), Player::ActivateSpec(), Spell::EffectApplyGlyph(), WorldSession::HandleCancelAuraOpcode(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandleRemoveGlyph(), AuraEffect::HandleShapeshiftBoosts(), boss_zuljin::JustEngagedWith(), spell_gen_animal_blood::OnApply(), spell_contagion_of_rot::OnApply(), UnitAura::Remove(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAurasDueToItemSpell(), RemoveEvadeAuras(), Player::RemoveItemDependentAurasAndCasts(), RemoveNotOwnSingleTargetAuras(), RemoveOwnedAura(), RemoveOwnedAura(), RemoveOwnedAuras(), RemoveOwnedAuras(), Player::removeSpell(), boss_falric::boss_falricAI::UpdateAI(), and Player::UpdateAreaDependentAuras().

◆ RemoveOwnedAura() [3/3]

void Unit::RemoveOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4727{
4728 for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
4729 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
4730 {
4731 RemoveOwnedAura(itr, removeMode);
4732 itr = m_ownedAuras.lower_bound(spellId);
4733 }
4734 else
4735 ++itr;
4736}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [1/2]

void Unit::RemoveOwnedAuras ( std::function< bool(Aura const *)> const &  check)
4858{
4859 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
4860 {
4861 if (check(iter->second))
4862 {
4863 RemoveOwnedAura(iter);
4864 continue;
4865 }
4866 ++iter;
4867 }
4868}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [2/2]

void Unit::RemoveOwnedAuras ( uint32  spellId,
std::function< bool(Aura const *)> const &  check 
)
4884{
4885 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
4886 {
4887 if (check(iter->second))
4888 {
4889 RemoveOwnedAura(iter);
4890 continue;
4891 }
4892 ++iter;
4893 }
4894}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemovePetAura()

void Unit::RemovePetAura ( PetAura const *  petSpell)
17333{
17334 if (!IsPlayer())
17335 return;
17336
17337 m_petAuras.erase(petSpell);
17338 if (Pet* pet = ToPlayer()->GetPet())
17339 pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry()));
17340 if (Unit* charm = GetCharm())
17341 charm->RemoveAurasDueToSpell(petSpell->GetAura(charm->GetEntry()));
17342}

References PetAura::GetAura(), GetCharm(), Object::IsPlayer(), m_petAuras, and Object::ToPlayer().

Referenced by Player::_removeTalentAurasAndSpells(), Pet::CastPetAuras(), AuraEffect::HandleAuraDummy(), and Player::removeSpell().

◆ RemovePlayerFromVision()

void Unit::RemovePlayerFromVision ( Player player)
11205{
11206 m_sharedVision.remove(player);
11207 player->m_isInSharedVisionOf.erase(this);
11208 if (m_sharedVision.empty())
11209 {
11210 setActive(false);
11211 SetWorldObject(false);
11212 }
11213}

References Player::m_isInSharedVisionOf, m_sharedVision, WorldObject::setActive(), and WorldObject::SetWorldObject().

Referenced by Player::SetViewpoint(), and Player::~Player().

◆ RemovePointedBy()

void Unit::RemovePointedBy ( SafeUnitPointer sup)
inline

◆ RemoveStandFlags()

void Unit::RemoveStandFlags ( uint8  flags)
inline
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition UnitDefines.h:25
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition Object.cpp:930

References flags, Object::RemoveByteFlag(), UNIT_BYTES_1_OFFSET_VIS_FLAG, and UNIT_FIELD_BYTES_1.

Referenced by AuraEffect::HandleModStealth(), Player::InitStatsForLevel(), and npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI().

◆ RemoveUnitFlag()

void Unit::RemoveUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

References flags, Object::RemoveFlag(), and UNIT_FIELD_FLAGS.

Referenced by spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), Player::BuildPlayerRepop(), boss_thekal::CheckPhaseTransition(), Player::CleanupAfterTaxiFlight(), ClearInCombat(), ClearInPetCombat(), boss_alar::DamageTaken(), DisableRotate(), boss_thorim::boss_thorimAI::DisableThorim(), Dismount(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_thekal::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_the_lurker_below::DoAction(), npc_frozen_core::DoAction(), boss_broggok::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_cthun::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_illidan_stormrage::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_kelidan_the_breaker::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), HomeMovementGenerator< Creature >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), WorldSession::DoLootRelease(), Spell::EffectResurrectPet(), Spell::EffectSkinning(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_bronjahm::boss_bronjahmAI::EnterEvadeMode(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), boss_kelthuzad::boss_kelthuzadAI::EnterEvadeMode(), boss_malygos::boss_malygosAI::EnterEvadeMode(), boss_ymiron::boss_ymironAI::EnterEvadeMode(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), SACActivateEvent::Execute(), boss_ingvar_the_plunderer::FeignDeath(), TimedFleeingMovementGenerator::Finalize(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_feign_death_all_flags::HandleEffectRemove(), spell_gen_feign_death_no_dyn_flag::HandleEffectRemove(), spell_gen_feign_death_no_prevent_emotes::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLogoutCancelOpcode(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), WorldSession::HandlePlayerLoginToCharInWorld(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_kiljaeden::InitializeAI(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), boss_volazj::JustDied(), boss_ichoron::boss_ichoronAI::JustDied(), boss_taerar::boss_taerarAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_ymiron::boss_ymironAI::JustEngagedWith(), boss_hazzarah::JustSummoned(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), boss_shade_of_akama::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_amanitar_mushrooms::npc_amanitar_mushrooms(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), npc_death_knight_initiate::OnGossipSelect(), npc_bessy::OnQuestAccept(), spell_halion_twilight_phasing_aura::OnRemove(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), RemoveCharmedBy(), Vehicle::RemovePassenger(), boss_keristrasza::RemovePrison(), boss_lord_valthalak::boss_lord_valthalakAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_crone::Reset(), boss_julianne::Reset(), npc_mograine::npc_mograineAI::Reset(), boss_felmyst::Reset(), boss_kalecgos::Reset(), boss_muru::Reset(), npc_harrison_jones::Reset(), npc_amanishi_lookout::Reset(), boss_eye_of_cthun::Reset(), boss_volazj::Reset(), boss_anub_arak::boss_anub_arakAI::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_novos::boss_novosAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_malygos::boss_malygosAI::Reset(), npc_crystalline_frayer::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_mimiron::boss_mimironAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_ingvar_the_plunderer::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_ichoron::boss_ichoronAI::Reset(), npc_wounded_skirmisher::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), boss_leotheras_the_blind::Reset(), npc_shattered_hand_scout::Reset(), boss_kaelthas::Reset(), advisor_baseAI::Reset(), emerald_dragonAI::Reset(), npc_doctor::npc_doctorAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), boss_the_lurker_below::SchedulerPhaseTwo(), SetCharm(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SetData(), npc_ulduar_vx001::npc_ulduar_vx001AI::SetData(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SetData(), Pet::setDeathState(), SetImmuneToNPC(), SetImmuneToPC(), Player::SetIsSpectator(), SetStunned(), SetSwim(), Battlefield::ShowNpc(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SpellHit(), npc_ulduar_vx001::npc_ulduar_vx001AI::SpellHit(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), advisor_baseAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::boss_lord_valthalakAI::StartFighting(), boss_noth::boss_nothAI::StartGroundPhase(), boss_felmyst::StartIntro(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_crystalline_frayer::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), and npc_general_andorov::WaypointReached().

◆ RemoveUnitFlag2()

◆ RemoveUnitMovementFlag()

◆ RemoveVehicleKit()

void Unit::RemoveVehicleKit ( )
18751{
18752 if (!m_vehicleKit)
18753 return;
18754
18756 delete m_vehicleKit;
18757
18758 m_vehicleKit = nullptr;
18759
18760 m_updateFlag &= ~UPDATEFLAG_VEHICLE;
18761 m_unitTypeMask &= ~UNIT_MASK_VEHICLE;
18763}
@ UNIT_NPC_FLAG_SPELLCLICK
Definition UnitDefines.h:339
@ UNIT_NPC_FLAG_PLAYER_VEHICLE
Definition UnitDefines.h:340
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:733

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, RemoveNpcFlag(), Vehicle::Uninstall(), UNIT_NPC_FLAG_PLAYER_VEHICLE, and UNIT_NPC_FLAG_SPELLCLICK.

Referenced by Dismount(), AuraEffect::HandleAuraSetVehicle(), npc_gunship::npc_gunshipAI::JustDied(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), and RemoveFromWorld().

◆ RemoveVisibleAura()

void Unit::RemoveVisibleAura ( uint8  slot)
inline
1471{ m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);}
void UpdateAuraForGroup(uint8 slot)
Definition Unit.cpp:17192

References m_visibleAuras, and UpdateAuraForGroup().

Referenced by AuraApplication::_Remove().

◆ ReplaceAllDynamicFlags()

◆ ReplaceAllNpcFlags()

void Unit::ReplaceAllNpcFlags ( NPCFlags  flags)
inline

References flags, SetUInt32Value(), and UNIT_NPC_FLAGS.

Referenced by Pet::CreateBaseAtTamed(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), Spell::EffectSummonType(), SmartAI::EndPath(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_akama_illidan::JustSummoned(), Pet::LoadPetFromDB(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_shandy_dalaran::OnGossipSelect(), go_crystalline_tear::OnQuestAccept(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), boss_doomrel::boss_doomrelAI::Reset(), npc_eris_hevenfire::npc_eris_hevenfireAI::Reset(), npc_taretha::npc_tarethaAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Creature::setDeathState(), npc_eris_hevenfire::npc_eris_hevenfireAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_akama_illidan::sGossipSelect(), npc_escortAI::Start(), FollowerAI::StartFollow(), SmartAI::StartPath(), Player::SummonPet(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), Creature::UpdateEntry(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), GameEventMgr::UpdateEventNPCFlags(), and npc_captain_saeed::npc_captain_saeedAI::WaypointReached().

◆ ReplaceAllUnitFlags()

◆ ReplaceAllUnitFlags2()

void Unit::ReplaceAllUnitFlags2 ( UnitFlags2  flags)
inline

◆ resetAttackTimer()

◆ ResetRedirectThreat()

◆ RestoreDisplayId()

void Unit::RestoreDisplayId ( )
16799{
16800 AuraEffect* handledAura = nullptr;
16801 AuraEffect* handledAuraForced = nullptr;
16802 // try to receive model from transform auras
16804 if (!transforms.empty())
16805 {
16806 // iterate over already applied transform auras - from newest to oldest
16807 for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
16808 {
16809 if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
16810 {
16811 if (!handledAura)
16812 handledAura = (*i);
16813 // xinef: prefer negative/forced auras
16814 if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !aurApp->IsPositive())
16815 {
16816 handledAuraForced = (*i);
16817 break;
16818 }
16819 }
16820 }
16821 }
16822
16823 // Xinef: include clone auras (eg mirror images)
16824 if (!handledAuraForced && !handledAura)
16825 {
16827 if (!cloneAuras.empty())
16828 for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i)
16829 handledAura = *i;
16830 }
16831
16833
16834 // xinef: order of execution is important!
16835 // first forced transform auras, then shapeshifts, then normal transform
16836 // transform aura was found
16837 if (handledAuraForced)
16838 {
16839 handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
16840 return;
16841 }
16842 else if (!shapeshiftAura.empty()) // we've found shapeshift
16843 {
16844 // only one such aura possible at a time
16845 if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
16846 {
16847 SetDisplayId(modelId);
16848 return;
16849 }
16850 }
16851 else if (handledAura)
16852 {
16853 handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
16854 return;
16855 }
16856
16857 // no auras found - set modelid to default
16859}
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition SpellAuraDefines.h:43
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition SpellAuraEffects.cpp:746
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition Unit.cpp:19223

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraApplication::GetBase(), Object::GetGUID(), GetModelForForm(), GetNativeDisplayId(), GetShapeshiftForm(), AuraEffect::HandleEffect(), SetDisplayId(), SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_CLONE_CASTER, SPELL_AURA_MOD_SHAPESHIFT, and SPELL_AURA_TRANSFORM.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), spell_gen_aura_service_uniform::OnRemove(), and Player::SetIsSpectator().

◆ RestoreFaction()

void Unit::RestoreFaction ( )
18719{
18720 if (IsPlayer())
18722 else
18723 {
18725 {
18726 if (Unit* owner = GetOwner())
18727 {
18728 SetFaction(owner->GetFaction());
18729 return;
18730 }
18731 }
18732
18733 if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
18734 SetFaction(cinfo->faction);
18735 }
18736}
void SetFactionForRace(uint8 race)
Definition Player.cpp:5880

References GetOwner(), getRace(), HasUnitTypeMask(), Object::IsPlayer(), SetFaction(), Player::SetFactionForRace(), Object::ToCreature(), Object::ToPlayer(), and UNIT_MASK_MINION.

Referenced by npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thekal::DoAction(), AuraEffect::HandleAuraModFaction(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_enslaved_netherwing_drake::JustDied(), npc_escortAI::JustRespawned(), SmartAI::JustRespawned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), RemoveCharmedBy(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_crusade_persuaded::npc_crusade_persuadedAI::Reset(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_ahnqiraji_critter::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_magister_aledis::Reset(), npc_captain_saeed::npc_captain_saeedAI::Reset(), npc_bessy::npc_bessyAI::Reset(), and npc_enslaved_netherwing_drake::Reset().

◆ ResumeMovement()

void Unit::ResumeMovement ( uint32  timer = 0,
uint8  slot = 0 
)
16704{
16705 if (slot >= MAX_MOTION_SLOT)
16706 return;
16707
16708 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
16709 movementGenerator->Resume(timer);
16710}

References GetMotionMaster(), and MAX_MOTION_SLOT.

Referenced by boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight().

◆ RewardRage()

void Unit::RewardRage ( uint32  damage,
uint32  weaponSpeedHitFactor,
bool  attacker 
)
20160{
20161 // Rage formulae https://wowwiki-archive.fandom.com/wiki/Rage#Formulae
20162 float addRage;
20163
20164 float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
20165
20166 // Unknown if correct, but lineary adjust rage conversion above level 70
20167 if (GetLevel() > 70)
20168 rageconversion += 13.27f * (GetLevel() - 70);
20169
20170 if (attacker)
20171 {
20172 // see Bornak's bluepost explanation (05/29/2009)
20173 float rageFromDamageDealt = damage / rageconversion * 7.5f;
20174 addRage = (rageFromDamageDealt + weaponSpeedHitFactor) / 2.0f;
20175 addRage = std::min(addRage, rageFromDamageDealt * 2.0f);
20177 }
20178 else
20179 {
20180 addRage = damage / rageconversion * 2.5f;
20181
20182 // Berserker Rage effect
20183 if (HasAura(18499))
20184 addRage *= 3.0f;
20185 }
20186
20187 addRage *= sWorld->getRate(RATE_POWER_RAGE_INCOME);
20188
20189 ModifyPower(POWER_RAGE, uint32(addRage * 10));
20190}
@ RATE_POWER_RAGE_INCOME
Definition IWorld.h:432
@ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT
Definition SpellAuraDefines.h:276

References AddPct(), GetLevel(), GetTotalAuraModifier(), HasAura(), ModifyPower(), POWER_RAGE, RATE_POWER_RAGE_INCOME, SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT, and sWorld.

Referenced by DealDamage(), and DealMeleeDamage().

◆ RollMeleeOutcomeAgainst() [1/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType 
) const
2782{
2783 // This is only wrapper
2784
2785 // Miss chance based on melee
2786 //float miss_chance = MeleeMissChanceCalc(victim, attType);
2787 float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(victim->GetMaxSkillValueForLevel(this)), 0);
2788
2789 // Critical hit chance
2790 float crit_chance = GetUnitCriticalChance(attType, victim);
2791 if (crit_chance < 0)
2792 crit_chance = 0;
2793
2794 float dodge_chance = victim->GetUnitDodgeChance();
2795 float block_chance = victim->GetUnitBlockChance();
2796 float parry_chance = victim->GetUnitParryChance();
2797
2798 // Useful if want to specify crit & miss chances for melee, else it could be removed
2799 //LOG_DEBUG("entities.unit", "MELEE OUTCOME: miss {} crit {} dodge {} parry {} block {}", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
2800
2801 return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
2802}
float GetUnitCriticalChance(WeaponAttackType attackType, Unit const *victim) const
Definition Unit.cpp:3728

References GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), MeleeSpellMissChance(), and RollMeleeOutcomeAgainst().

Referenced by CalculateMeleeDamage(), and RollMeleeOutcomeAgainst().

◆ RollMeleeOutcomeAgainst() [2/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType,
int32  crit_chance,
int32  miss_chance,
int32  dodge_chance,
int32  parry_chance,
int32  block_chance 
) const
2805{
2806 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks())
2807 {
2808 return MELEE_HIT_EVADE;
2809 }
2810
2811 int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
2812 int32 victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
2813
2814 int32 attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
2815 int32 victimDefenseSkill = victim->GetDefenseSkillValue(this);
2816
2817 sScriptMgr->OnBeforeRollMeleeOutcomeAgainst(this, victim, attType, attackerMaxSkillValueForLevel, victimMaxSkillValueForLevel, attackerWeaponSkill, victimDefenseSkill, crit_chance, miss_chance, dodge_chance, parry_chance, block_chance);
2818
2819 // bonus from skills is 0.04%
2820 int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel);
2821 int32 sum = 0, tmp = 0;
2822 int32 roll = urand (0, 10000);
2823
2824 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: skill bonus of {} for attacker", skillBonus);
2825 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: rolled {}, miss {}, dodge {}, parry {}, block {}, crit {}",
2826 // roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
2827
2828 tmp = miss_chance;
2829
2830 if (tmp > 0 && roll < (sum += tmp))
2831 {
2832 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: MISS");
2833 return MELEE_HIT_MISS;
2834 }
2835
2836 // Dodge chance
2837
2838 // only players can't dodge if attacker is behind
2839 if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
2840 {
2841 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
2842 }
2843 // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
2844 else if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE))
2845 {
2846 // Reduce dodge chance by attacker expertise rating
2847 if (IsPlayer())
2848 dodge_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2849 else
2850 dodge_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2851
2852 // Modify dodge chance by attacker SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
2854 dodge_chance = int32 (float (dodge_chance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
2855
2856 tmp = dodge_chance;
2857
2858 // xinef: if casting or stunned - cant dodge
2859 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2860 tmp = 0;
2861
2862 if ((tmp > 0) // check if unit _can_ dodge
2863 && ((tmp -= skillBonus) > 0)
2864 && roll < (sum += tmp))
2865 {
2866 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: DODGE <{}, {})", sum - tmp, sum);
2867 return MELEE_HIT_DODGE;
2868 }
2869 }
2870
2871 // parry & block chances
2872
2873 // check if attack comes from behind, nobody can parry or block if attacker is behind
2874 if (!victim->HasInArc(M_PI, this) && !victim->HasIgnoreHitDirectionAura())
2875 {
2876 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
2877 }
2878 else
2879 {
2880 // Reduce parry chance by attacker expertise rating
2881 if (IsPlayer())
2882 parry_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2883 else
2884 parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2885
2886 if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
2887 {
2888 tmp = parry_chance;
2889
2890 // xinef: cant parry while casting or while stunned
2891 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2892 tmp = 0;
2893
2894 if (tmp > 0 // check if unit _can_ parry
2895 && (tmp -= skillBonus) > 0
2896 && roll < (sum += tmp))
2897 {
2898 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: PARRY <{}, {})", sum - tmp, sum);
2899 return MELEE_HIT_PARRY;
2900 }
2901 }
2902
2903 if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
2904 {
2905 tmp = block_chance;
2906
2907 // xinef: cant block while casting or while stunned
2908 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2909 tmp = 0;
2910
2911 if (tmp > 0 // check if unit _can_ block
2912 && (tmp -= skillBonus) > 0
2913 && roll < (sum += tmp))
2914 {
2915 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: BLOCK <{}, {})", sum - tmp, sum);
2916 return MELEE_HIT_BLOCK;
2917 }
2918 }
2919 }
2920
2921 // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
2922 if (attType != RANGED_ATTACK &&
2923 (IsPlayer() || IsPet()) &&
2924 !victim->IsPlayer() && !victim->IsPet() &&
2925 GetLevel() < victim->getLevelForTarget(this))
2926 {
2927 // cap possible value (with bonuses > max skill)
2928 int32 skill = attackerWeaponSkill;
2929 int32 maxskill = attackerMaxSkillValueForLevel;
2930 skill = (skill > maxskill) ? maxskill : skill;
2931
2932 tmp = (10 + (victimDefenseSkill - skill)) * 100;
2933 tmp = tmp > 4000 ? 4000 : tmp;
2934 if (roll < (sum += tmp))
2935 {
2936 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: GLANCING <{}, {})", sum - 4000, sum);
2937 return MELEE_HIT_GLANCING;
2938 }
2939 }
2940
2941 // mobs can score crushing blows if they're 4 or more levels above victim
2942 if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
2943 // can be from by creature (if can) or from controlled player that considered as creature
2945 !(IsCreature() && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS))
2946 {
2947 // when their weapon skill is 15 or more above victim's defense skill
2948 tmp = victimDefenseSkill;
2949 int32 tmpmax = victimMaxSkillValueForLevel;
2950 // having defense above your maximum (from items, talents etc.) has no effect
2951 tmp = tmp > tmpmax ? tmpmax : tmp;
2952 // tmp = mob's level * 5 - player's current defense skill
2953 tmp = attackerMaxSkillValueForLevel - tmp;
2954 if (tmp >= 15)
2955 {
2956 // add 2% chance per lacking skill point, min. is 15%
2957 tmp = tmp * 200 - 1500;
2958 if (roll < (sum += tmp))
2959 {
2960 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRUSHING <{}, {})", sum - tmp, sum);
2961 return MELEE_HIT_CRUSHING;
2962 }
2963 }
2964 }
2965
2966 // Critical chance
2967 tmp = crit_chance;
2968
2969 if (tmp > 0 && roll < (sum += tmp))
2970 {
2971 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <{}, {})", sum - tmp, sum);
2972 if (IsCreature() && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
2973 {
2974 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)");
2975 }
2976 else
2977 return MELEE_HIT_CRIT;
2978 }
2979
2980 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: NORMAL");
2981 return MELEE_HIT_NORMAL;
2982}
@ CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS
Definition CreatureData.h:50
@ CREATURE_FLAG_EXTRA_NO_CRIT
Definition CreatureData.h:62

References CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_CRIT, CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetDefenseSkillValue(), GetLevel(), getLevelForTarget(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetWeaponSkillValue(), HasIgnoreHitDirectionAura(), Position::HasInArc(), HasUnitState(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsNonMeleeSpellCast(), IsPet(), Object::IsPlayer(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, RANGED_ATTACK, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONTROLLED, urand(), and VICTIMSTATE_DODGE.

◆ Say() [1/2]

◆ Say() [2/2]

void Unit::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

21221{
21222 Talk(textId, CHAT_MSG_MONSTER_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
21223}

References CHAT_MSG_MONSTER_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ SelectNearbyNoTotemTarget()

Unit * Unit::SelectNearbyNoTotemTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
17043{
17044 std::list<Unit*> targets;
17045 Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist);
17047 Cell::VisitAllObjects(this, searcher, dist);
17048
17049 // remove current target
17050 if (GetVictim())
17051 targets.remove(GetVictim());
17052
17053 if (exclude)
17054 targets.remove(exclude);
17055
17056 // remove not LoS targets
17057 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
17058 {
17059 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
17060 {
17061 std::list<Unit*>::iterator tIter2 = tIter;
17062 ++tIter;
17063 targets.erase(tIter2);
17064 }
17065 else
17066 ++tIter;
17067 }
17068
17069 // no appropriate targets
17070 if (targets.empty())
17071 return nullptr;
17072
17073 // select random
17075}
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition Unit.cpp:13894
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133
Definition GridNotifiers.h:423

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitAllObjects().

Referenced by spell_rog_blade_flurry::CheckProc(), and spell_warr_sweeping_strikes::CheckProc().

◆ SelectNearbyTarget()

Unit * Unit::SelectNearbyTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
17008{
17009 std::list<Unit*> targets;
17010 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
17012 Cell::VisitAllObjects(this, searcher, dist);
17013
17014 // remove current target
17015 if (GetVictim())
17016 targets.remove(GetVictim());
17017
17018 if (exclude)
17019 targets.remove(exclude);
17020
17021 // remove not LoS targets
17022 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
17023 {
17024 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
17025 {
17026 std::list<Unit*>::iterator tIter2 = tIter;
17027 ++tIter;
17028 targets.erase(tIter2);
17029 }
17030 else
17031 ++tIter;
17032 }
17033
17034 // no appropriate targets
17035 if (targets.empty())
17036 return nullptr;
17037
17038 // select random
17040}
Definition GridNotifiers.h:861

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitAllObjects().

Referenced by boss_yazzai::JustEngagedWith(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_curator::JustSummoned(), npc_hodirs_fury::npc_hodirs_furyAI::UpdateAI(), npc_storm_beacon_spawn::npc_storm_beacon_spawnAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_thorim_trap::boss_thorim_trapAI::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), Player::UpdateCharmedAI(), and boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI().

◆ SendAttackStateUpdate() [1/2]

void Unit::SendAttackStateUpdate ( CalcDamageInfo damageInfo)

Probably used for debugging purposes, as it is not known to appear on retail servers

6503{
6504 LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
6505
6506 uint32 tmpDamage[MAX_ITEM_PROTO_DAMAGES] = { };
6507 uint32 tmpAbsorb[MAX_ITEM_PROTO_DAMAGES] = { };
6508 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6509 {
6510 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6511 tmpDamage[i] = damageInfo->damages[i].damage;
6512 tmpAbsorb[i] = damageInfo->damages[i].absorb;
6513 if (damageInfo->target->IsPlayer() && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6514 {
6515 tmpAbsorb[i] = tmpDamage[i];
6516 tmpDamage[i] = 0;
6517 }
6518 }
6519
6520 uint32 count = 1;
6521 if (tmpDamage[1] || tmpAbsorb[1] || damageInfo->damages[1].resist)
6522 {
6523 ++count;
6524 }
6525
6526 std::size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
6527 WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
6528 data << uint32(damageInfo->HitInfo);
6529 data << damageInfo->attacker->GetPackGUID();
6530 data << damageInfo->target->GetPackGUID();
6531 data << uint32(tmpDamage[0] + tmpDamage[1]); // Full damage
6532 int32 overkill = tmpDamage[0] + tmpDamage[1] - damageInfo->target->GetHealth();
6533 data << uint32(overkill < 0 ? 0 : overkill); // Overkill
6534 data << uint8(count); // Sub damage count
6535
6536 for (uint32 i = 0; i < count; ++i)
6537 {
6538 data << uint32(damageInfo->damages[i].damageSchoolMask); // School of sub damage
6539 data << float(tmpDamage[i]); // sub damage
6540 data << uint32(tmpDamage[i]); // Sub Damage
6541 }
6542
6544 {
6545 for (uint32 i = 0; i < count; ++i)
6546 {
6547 data << uint32(tmpAbsorb[i]); // Absorb
6548 }
6549 }
6550
6552 {
6553 for (uint32 i = 0; i < count; ++i)
6554 {
6555 data << uint32(damageInfo->damages[i].resist); // Resist
6556 }
6557 }
6558
6559 data << uint8(damageInfo->TargetState);
6560 data << uint32(0); // Unknown attackerstate
6561 data << uint32(0); // Melee spellid
6562
6563 if (damageInfo->HitInfo & HITINFO_BLOCK)
6564 data << uint32(damageInfo->blocked_amount);
6565
6566 if (damageInfo->HitInfo & HITINFO_RAGE_GAIN)
6567 data << uint32(0);
6568
6570 if (damageInfo->HitInfo & HITINFO_UNK1)
6571 {
6572 data << uint32(0);
6573 data << float(0);
6574 data << float(0);
6575 data << float(0);
6576 data << float(0);
6577 data << float(0);
6578 data << float(0);
6579 data << float(0);
6580 data << float(0);
6581 data << float(0); // Found in a loop with 1 iteration
6582 data << float(0); // ditto ^
6583 data << uint32(0);
6584 }
6585
6586 SendMessageToSet(&data, true);
6587}
@ HITINFO_RAGE_GAIN
Definition Unit.h:120
@ HITINFO_UNK1
Definition Unit.h:97
@ SMSG_ATTACKERSTATEUPDATE
Definition Opcodes.h:360

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CHEAT_GOD, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), CalcDamageInfo::HitInfo, HITINFO_BLOCK, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_RAGE_GAIN, HITINFO_UNK1, Object::IsPlayer(), LOG_DEBUG, MAX_ITEM_PROTO_DAMAGES, CalcDamageInfo::resist, WorldObject::SendMessageToSet(), SMSG_ATTACKERSTATEUPDATE, CalcDamageInfo::target, CalcDamageInfo::TargetState, and Object::ToPlayer().

Referenced by AttackerStateUpdate(), misc_commandscript::HandleDamageCommand(), spell_dk_dancing_rune_weapon::HandleProc(), and SendAttackStateUpdate().

◆ SendAttackStateUpdate() [2/2]

void Unit::SendAttackStateUpdate ( uint32  HitInfo,
Unit target,
uint8  SwingType,
SpellSchoolMask  damageSchoolMask,
uint32  Damage,
uint32  AbsorbDamage,
uint32  Resist,
VictimState  TargetState,
uint32  BlockedAmount 
)
6590{
6591 CalcDamageInfo dmgInfo;
6592 dmgInfo.HitInfo = HitInfo;
6593 dmgInfo.attacker = this;
6594 dmgInfo.target = target;
6595
6596 dmgInfo.damages[0].damage = Damage - AbsorbDamage - Resist - BlockedAmount;
6597 dmgInfo.damages[0].damageSchoolMask = damageSchoolMask;
6598 dmgInfo.damages[0].absorb = AbsorbDamage;
6599 dmgInfo.damages[0].resist = Resist;
6600
6601 dmgInfo.damages[1].damage = 0;
6602 dmgInfo.damages[1].damageSchoolMask = 0;
6603 dmgInfo.damages[1].absorb = 0;
6604 dmgInfo.damages[1].resist = 0;
6605
6606 dmgInfo.TargetState = TargetState;
6607 dmgInfo.blocked_amount = BlockedAmount;
6608 SendAttackStateUpdate(&dmgInfo);
6609}
HitInfo
Definition Unit.h:95

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, CalcDamageInfo::HitInfo, CalcDamageInfo::resist, SendAttackStateUpdate(), CalcDamageInfo::target, and CalcDamageInfo::TargetState.

◆ SendChangeCurrentVictimOpcode()

void Unit::SendChangeCurrentVictimOpcode ( HostileReference pHostileReference)
20122{
20123 if (!GetThreatMgr().isThreatListEmpty())
20124 {
20125 uint32 count = GetThreatMgr().GetThreatList().size();
20126
20127 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
20128 WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
20129 data << GetPackGUID();
20130 data << pHostileReference->getUnitGuid().WriteAsPacked();
20131 data << uint32(count);
20133 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
20134 {
20135 data << (*itr)->getUnitGuid().WriteAsPacked();
20136 data << uint32((*itr)->GetThreat() * 100);
20137 }
20138 SendMessageToSet(&data, false);
20139 }
20140}
PackedGuid WriteAsPacked() const
Definition ObjectGuid.h:316
std::list< HostileReference * > StorageType
Definition ThreatMgr.h:147
@ SMSG_HIGHEST_THREAT_UPDATE
Definition Opcodes.h:1184

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_HIGHEST_THREAT_UPDATE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::setCurrentVictim().

◆ SendClearTarget()

void Unit::SendClearTarget ( )
20350{
20352 data << GetPackGUID();
20353 SendMessageToSet(&data, false);
20354}
@ SMSG_BREAK_TARGET
Definition Opcodes.h:368

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_BREAK_TARGET.

Referenced by Vehicle::AddPassenger(), and Spell::EffectForceDeselect().

◆ SendClearThreatListOpcode()

void Unit::SendClearThreatListOpcode ( )
20143{
20144 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message");
20146 data << GetPackGUID();
20147 SendMessageToSet(&data, false);
20148}
@ SMSG_THREAT_CLEAR
Definition Opcodes.h:1187

References Object::GetPackGUID(), LOG_DEBUG, WorldObject::SendMessageToSet(), and SMSG_THREAT_CLEAR.

Referenced by ThreatMgr::ClearAllThreat().

◆ SendComboPoints()

void Unit::SendComboPoints ( )
16905{
16906 if (m_cleanupDone)
16907 {
16908 return;
16909 }
16910
16912 if (Player* playerMe = ToPlayer())
16913 {
16914 WorldPacket data(SMSG_UPDATE_COMBO_POINTS, packGUID.size() + 1);
16915 data << packGUID;
16916 data << uint8(m_comboPoints);
16917 playerMe->SendDirectMessage(&data);
16918 }
16919
16920 ObjectGuid ownerGuid = GetCharmerOrOwnerGUID();
16921 Player* owner = nullptr;
16922 if (ownerGuid.IsPlayer())
16923 {
16924 owner = ObjectAccessor::GetPlayer(*this, ownerGuid);
16925 }
16926
16927 if (m_movedByPlayer || owner)
16928 {
16929 WorldPacket data(SMSG_PET_UPDATE_COMBO_POINTS, GetPackGUID().size() + packGUID.size() + 1);
16930 data << GetPackGUID();
16931 data << packGUID;
16932 data << uint8(m_comboPoints);
16933
16934 if (m_movedByPlayer)
16936
16937 if (owner && owner != m_movedByPlayer)
16938 owner->SendDirectMessage(&data);
16939 }
16940}
Definition ObjectGuid.h:263
std::size_t size() const
Definition ObjectGuid.h:274
@ SMSG_PET_UPDATE_COMBO_POINTS
Definition Opcodes.h:1200
@ SMSG_UPDATE_COMBO_POINTS
Definition Opcodes.h:955

References GetCharmerOrOwnerGUID(), Object::GetPackGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), m_cleanupDone, m_comboPoints, m_comboTarget, m_movedByPlayer, Player::SendDirectMessage(), PackedGuid::size(), SMSG_PET_UPDATE_COMBO_POINTS, SMSG_UPDATE_COMBO_POINTS, and Object::ToPlayer().

Referenced by AddComboPoints(), and ClearComboPoints().

◆ SendEnergizeSpellLog()

void Unit::SendEnergizeSpellLog ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
11284{
11285 WorldPacket data(SMSG_SPELLENERGIZELOG, (8 + 8 + 4 + 4 + 4 + 1));
11286 data << victim->GetPackGUID();
11287 data << GetPackGUID();
11288 data << uint32(spellID);
11289 data << uint32(powerType);
11290 data << uint32(damage);
11291 SendMessageToSet(&data, true);
11292}
@ SMSG_SPELLENERGIZELOG
Definition Opcodes.h:367

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLENERGIZELOG.

Referenced by EnergizeBySpell(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ SendHealSpellLog()

void Unit::SendHealSpellLog ( HealInfo const &  healInfo,
bool  critical = false 
)
11251{
11252 uint32 overheal = healInfo.GetHeal() - healInfo.GetEffectiveHeal();
11253
11254 // we guess size
11255 WorldPacket data(SMSG_SPELLHEALLOG, (8 + 8 + 4 + 4 + 4 + 4 + 1 + 1));
11256 data << healInfo.GetTarget()->GetPackGUID();
11257 data << GetPackGUID();
11258 data << uint32(healInfo.GetSpellInfo()->Id);
11259 data << uint32(healInfo.GetHeal());
11260 data << uint32(overheal);
11261 data << uint32(healInfo.GetAbsorb()); // Absorb amount
11262 data << uint8(critical ? 1 : 0);
11263 data << uint8(0); // unused
11264 SendMessageToSet(&data, true);
11265}
@ SMSG_SPELLHEALLOG
Definition Opcodes.h:366

References HealInfo::GetAbsorb(), HealInfo::GetEffectiveHeal(), HealInfo::GetHeal(), Object::GetPackGUID(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SpellInfo::Id, WorldObject::SendMessageToSet(), and SMSG_SPELLHEALLOG.

Referenced by HealBySpell().

◆ SendMeleeAttackStart()

void Unit::SendMeleeAttackStart ( Unit victim,
Player sendTo = nullptr 
)
3062{
3063 WorldPacket data(SMSG_ATTACKSTART, 8 + 8);
3064 data << GetGUID();
3065 data << victim->GetGUID();
3066 if (sendTo)
3067 sendTo->SendDirectMessage(&data);
3068 else
3069 SendMessageToSet(&data, true);
3070 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART");
3071}
@ SMSG_ATTACKSTART
Definition Opcodes.h:353

References Object::GetGUID(), Object::GetGUID(), LOG_DEBUG, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), and SMSG_ATTACKSTART.

Referenced by Attack(), Player::GetInitialVisiblePackets(), and boss_leotheras_the_blind::Reset().

◆ SendMeleeAttackStop()

void Unit::SendMeleeAttackStop ( Unit victim = nullptr)

Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.

3078{
3079 // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating!
3080 // pussywizard: this happens in some boss scripts, just add clearing here
3081 // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // commented out for now
3082
3083 WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4));
3084 data << GetPackGUID();
3085
3086 if (victim)
3087 {
3088 data << victim->GetPackGUID();
3089 data << (uint32)victim->isDead();
3090 }
3091 SendMessageToSet(&data, true);
3092 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP");
3093
3094 if (victim)
3095 LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString(), (victim->IsPlayer() ? "player" : "creature"), victim->GetGUID().ToString());
3096 else
3097 LOG_DEBUG("entities.unit", "{} {} stopped attacking", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString());
3098}
bool isDead() const
Definition Unit.h:1706
@ SMSG_ATTACKSTOP
Definition Opcodes.h:354

References Object::GetGUID(), Object::GetGUID(), Object::GetPackGUID(), isDead(), Object::IsPlayer(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_ATTACKSTOP, and ObjectGuid::ToString().

Referenced by Attack(), AttackStop(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_svalna_revive_champion::Land(), boss_leotheras_the_blind::Reset(), SetControlled(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), and boss_razorscale::boss_razorscaleAI::UpdateAI().

◆ SendMonsterMove()

void Unit::SendMonsterMove ( float  NewPosX,
float  NewPosY,
float  NewPosZ,
uint32  TransitTime,
SplineFlags  sf = SPLINEFLAG_WALK_MODE 
)
538{
539 WorldPacket data(SMSG_MONSTER_MOVE, 1 + 12 + 4 + 1 + 4 + 4 + 4 + 12 + GetPackGUID().size());
540 data << GetPackGUID();
541
542 data << uint8(0); // new in 3.1
543 data << GetPositionX() << GetPositionY() << GetPositionZ();
544 data << GameTime::GetGameTimeMS().count();
545 data << uint8(0);
546 data << uint32(sf);
547 data << TransitTime; // Time in between points
548 data << uint32(1); // 1 single waypoint
549 data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
550
551 SendMessageToSet(&data, true);
552}
@ SMSG_MONSTER_MOVE
Definition Opcodes.h:251

References GameTime::GetGameTimeMS(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::SendMessageToSet(), and SMSG_MONSTER_MOVE.

Referenced by npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI().

◆ SendMovementFeatherFall()

void Unit::SendMovementFeatherFall ( Player sendTo)
20688{
20689 if (!movespline->Initialized())
20690 return;
20692 data << GetPackGUID();
20693 sendTo->SendDirectMessage(&data);
20694}
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition Opcodes.h:803

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_FEATHER_FALL.

Referenced by Player::GetAurasForTarget().

◆ SendMovementFlagUpdate()

void Unit::SendMovementFlagUpdate ( bool  self = false)
16728{
16729 WorldPacket data;
16730 BuildHeartBeatMsg(&data);
16731 SendMessageToSet(&data, self);
16732}
void BuildHeartBeatMsg(WorldPacket *data) const
Definition Object.cpp:2084

References BuildHeartBeatMsg(), and WorldObject::SendMessageToSet().

Referenced by boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_nightbane::EnterEvadeMode(), boss_kaelthas::ExecuteMiddleEvent(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_harbinger_skyriss::JustSummoned(), MotionMaster::MoveFall(), npc_twilight_volunteer::MovementInform(), boss_felmyst::MovementInform(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), boss_felmyst::ScheduleFlightSequence(), SetCharm(), SetHover(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_felmyst::StartIntro(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), Player::UpdateCharmedAI(), and brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI().

◆ SendMovementHover()

void Unit::SendMovementHover ( Player sendTo)
20725{
20726 if (!movespline->Initialized())
20727 return;
20729 data << GetPackGUID();
20730 sendTo->SendDirectMessage(&data);
20731}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition Opcodes.h:805

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_SET_HOVER.

Referenced by Player::GetAurasForTarget().

◆ SendMovementWaterWalking()

void Unit::SendMovementWaterWalking ( Player sendTo)
20666{
20667 if (!movespline->Initialized())
20668 return;
20670 data << GetPackGUID();
20671 sendTo->SendDirectMessage(&data);
20672}
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition Opcodes.h:807

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_WATER_WALK.

Referenced by Player::GetAurasForTarget().

◆ SendPeriodicAuraLog()

void Unit::SendPeriodicAuraLog ( SpellPeriodicAuraLogInfo pInfo)
6413{
6414 AuraEffect const* aura = pInfo->auraEff;
6416 data << GetPackGUID();
6417 data << aura->GetCasterGUID().WriteAsPacked();
6418 data << uint32(aura->GetId()); // spellId
6419 data << uint32(1); // count
6420 data << uint32(aura->GetAuraType()); // auraId
6421 switch (aura->GetAuraType())
6422 {
6425 {
6426 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6427 uint32 damage = pInfo->damage;
6428 uint32 absorb = pInfo->absorb;
6429 if (IsPlayer() && ToPlayer()->GetCommandStatus(CHEAT_GOD))
6430 {
6431 absorb = damage;
6432 damage = 0;
6433 }
6434
6435 data << uint32(damage); // damage
6436 data << uint32(pInfo->overDamage); // overkill?
6437 data << uint32(aura->GetSpellInfo()->GetSchoolMask());
6438 data << uint32(absorb); // absorb
6439 data << uint32(pInfo->resist); // resist
6440 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6441 }
6442 break;
6445 data << uint32(pInfo->damage); // damage
6446 data << uint32(pInfo->overDamage); // overheal
6447 data << uint32(pInfo->absorb); // absorb
6448 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6449 break;
6452 data << uint32(aura->GetMiscValue()); // power type
6453 data << uint32(pInfo->damage); // damage
6454 break;
6456 data << uint32(aura->GetMiscValue()); // power type
6457 data << uint32(pInfo->damage); // amount
6458 data << float(pInfo->multiplier); // gain multiplier
6459 break;
6460 default:
6461 LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura {}", uint32(aura->GetAuraType()));
6462 return;
6463 }
6464
6465 SendMessageToSet(&data, true);
6466}
@ SPELL_AURA_OBS_MOD_HEALTH
Definition SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition SpellAuraDefines.h:127
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition SpellAuraDefines.h:87
@ SMSG_PERIODICAURALOG
Definition Opcodes.h:620
float multiplier
Definition Unit.h:521
bool critical
Definition Unit.h:522
uint32 overDamage
Definition Unit.h:518
uint32 resist
Definition Unit.h:520
uint32 damage
Definition Unit.h:517
AuraEffect const * auraEff
Definition Unit.h:516
uint32 absorb
Definition Unit.h:519

References SpellPeriodicAuraLogInfo::absorb, SpellPeriodicAuraLogInfo::auraEff, CHEAT_GOD, SpellPeriodicAuraLogInfo::critical, SpellPeriodicAuraLogInfo::damage, AuraEffect::GetAuraType(), AuraEffect::GetCasterGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), Object::GetPackGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Object::IsPlayer(), LOG_ERROR, SpellPeriodicAuraLogInfo::multiplier, SpellPeriodicAuraLogInfo::overDamage, SpellPeriodicAuraLogInfo::resist, WorldObject::SendMessageToSet(), SMSG_PERIODICAURALOG, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_MANA_LEECH, Object::ToPlayer(), and ObjectGuid::WriteAsPacked().

Referenced by AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SendPetActionFeedback()

void Unit::SendPetActionFeedback ( uint8  msg)

-------—Pet responses methods--------------—

16632{
16633 Unit* owner = GetOwner();
16634 if (!owner || !owner->IsPlayer())
16635 return;
16636
16638 data << uint8(msg);
16639 owner->ToPlayer()->GetSession()->SendPacket(&data);
16640}
@ SMSG_PET_ACTION_FEEDBACK
Definition Opcodes.h:740

References GetOwner(), Player::GetSession(), Object::IsPlayer(), WorldSession::SendPacket(), SMSG_PET_ACTION_FEEDBACK, and Object::ToPlayer().

Referenced by WorldSession::HandlePetCancelAuraOpcode().

◆ SendPetAIReaction()

void Unit::SendPetAIReaction ( ObjectGuid  guid)
16655{
16656 Unit* owner = GetOwner();
16657 if (!owner || !owner->IsPlayer())
16658 return;
16659
16660 WorldPacket data(SMSG_AI_REACTION, 8 + 4);
16661 data << guid;
16662 data << uint32(AI_REACTION_HOSTILE);
16663 owner->ToPlayer()->GetSession()->SendPacket(&data);
16664}
@ SMSG_AI_REACTION
Definition Opcodes.h:346

References AI_REACTION_HOSTILE, GetOwner(), Player::GetSession(), Object::IsPlayer(), WorldSession::SendPacket(), SMSG_AI_REACTION, and Object::ToPlayer().

Referenced by PetAI::DoAttack(), and WorldSession::HandlePetActionHelper().

◆ SendPetTalk()

void Unit::SendPetTalk ( uint32  pettalk)
16643{
16644 Unit* owner = GetOwner();
16645 if (!owner || !owner->IsPlayer())
16646 return;
16647
16649 data << GetGUID();
16650 data << uint32(pettalk);
16651 owner->ToPlayer()->GetSession()->SendPacket(&data);
16652}
@ SMSG_PET_ACTION_SOUND
Definition Opcodes.h:834

References Object::GetGUID(), GetOwner(), Player::GetSession(), Object::IsPlayer(), WorldSession::SendPacket(), SMSG_PET_ACTION_SOUND, and Object::ToPlayer().

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPlaySpellImpact()

void Unit::SendPlaySpellImpact ( ObjectGuid  guid,
uint32  id 
)
18943{
18945 data << guid; // target
18946 data << uint32(id); // SpellVisualKit.dbc index
18947 SendMessageToSet(&data, true);
18948}
@ SMSG_PLAY_SPELL_IMPACT
Definition Opcodes.h:533

References WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_IMPACT.

Referenced by debug_commandscript::HandleDebugVisualCommand(), and WorldSession::HandleTrainerBuySpellOpcode().

◆ SendPlaySpellVisual()

void Unit::SendPlaySpellVisual ( uint32  id)
18935{
18937 data << GetGUID();
18938 data << uint32(id); // SpellVisualKit.dbc index
18939 SendMessageToSet(&data, true);
18940}
@ SMSG_PLAY_SPELL_VISUAL
Definition Opcodes.h:529

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_VISUAL.

Referenced by debug_commandscript::HandleDebugVisualCommand(), WorldSession::HandleTrainerBuySpellOpcode(), SmartScript::ProcessAction(), and Player::RegenerateAll().

◆ SendRemoveFromThreatListOpcode()

void Unit::SendRemoveFromThreatListOpcode ( HostileReference pHostileReference)
20151{
20152 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
20153 WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
20154 data << GetPackGUID();
20155 data << pHostileReference->getUnitGuid().WriteAsPacked();
20156 SendMessageToSet(&data, false);
20157}
@ SMSG_THREAT_REMOVE
Definition Opcodes.h:1186

References Object::GetPackGUID(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_THREAT_REMOVE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::processThreatEvent().

◆ SendSpellDamageImmune()

void Unit::SendSpellDamageImmune ( Unit target,
uint32  spellId 
)
6493{
6494 WorldPacket data(SMSG_SPELLORDAMAGE_IMMUNE, 8 + 8 + 4 + 1);
6495 data << GetGUID();
6496 data << target->GetGUID();
6497 data << uint32(spellId);
6498 data << uint8(0); // bool - log format: 0-default, 1-debug
6499 SendMessageToSet(&data, true);
6500}
@ SMSG_SPELLORDAMAGE_IMMUNE
Definition Opcodes.h:641

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLORDAMAGE_IMMUNE.

Referenced by DealMeleeDamage(), Spell::EffectEnergize(), Spell::EffectHealMaxHealth(), and AuraEffect::SendTickImmune().

◆ SendSpellDamageResist()

void Unit::SendSpellDamageResist ( Unit target,
uint32  spellId 
)
6483{
6484 WorldPacket data(SMSG_PROCRESIST, 8 + 8 + 4 + 1);
6485 data << GetGUID();
6486 data << target->GetGUID();
6487 data << uint32(spellId);
6488 data << uint8(0); // bool - log format: 0-default, 1-debug
6489 SendMessageToSet(&data, true);
6490}
@ SMSG_PROCRESIST
Definition Opcodes.h:638

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PROCRESIST.

◆ SendSpellMiss()

void Unit::SendSpellMiss ( Unit target,
uint32  spellID,
SpellMissInfo  missInfo 
)
6469{
6470 WorldPacket data(SMSG_SPELLLOGMISS, (4 + 8 + 1 + 4 + 8 + 1));
6471 data << uint32(spellID);
6472 data << GetGUID();
6473 data << uint8(0); // can be 0 or 1
6474 data << uint32(1); // target count
6475 // for (i = 0; i < target count; ++i)
6476 data << target->GetGUID(); // target GUID
6477 data << uint8(missInfo);
6478 // end loop
6479 SendMessageToSet(&data, true);
6480}
@ SMSG_SPELLLOGMISS
Definition Opcodes.h:617

References Object::GetGUID(), Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLLOGMISS.

Referenced by DealMeleeDamage(), and Spell::DoAllEffectOnTarget().

◆ SendSpellNonMeleeDamageLog() [1/2]

void Unit::SendSpellNonMeleeDamageLog ( SpellNonMeleeDamage log)
6334{
6335 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6336 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6337 uint32 damage = log->damage;
6338 uint32 absorb = log->absorb;
6339 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6340 {
6341 absorb = damage;
6342 damage = 0;
6343 }
6344 data << log->target->GetPackGUID();
6345 data << log->attacker->GetPackGUID();
6346 data << uint32(log->spellInfo->Id);
6347 data << uint32(damage); // damage amount
6348 int32 overkill = damage - log->target->GetHealth();
6349 data << uint32(overkill > 0 ? overkill : 0); // overkill
6350 data << uint8 (log->schoolMask); // damage school
6351 data << uint32(absorb); // AbsorbedDamage
6352 data << uint32(log->resist); // resist
6353 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6354 data << uint8 (log->unused); // unused
6355 data << uint32(log->blocked); // blocked
6356 data << uint32(log->HitInfo);
6357 data << uint32(log->HitInfo);
6359 //if (log->HitInfo & SPELL_HIT_TYPE_CRIT_DEBUG)
6360 //{
6361 // data << float(log->CritRoll);
6362 // data << float(log->CritNeeded);
6363 //}
6364 //if (log->HitInfo & SPELL_HIT_TYPE_HIT_DEBUG)
6365 //{
6366 // data << float(log->HitRoll);
6367 // data << float(log->HitNeeded);
6368 //}
6369 //if (log->HitInfo & SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG)
6370 //{
6371 // data << float(log->MissChance);
6372 // data << float(log->DodgeChance);
6373 // data << float(log->ParryChance);
6374 // data << float(log->BlockChance);
6375 // data << float(log->GlanceChance);
6376 // data << float(log->CrushChance);
6377 //}
6378 SendMessageToSet(&data, true);
6379}
@ SPELL_HIT_TYPE_HIT_DEBUG
Definition SharedDefines.h:1537
@ SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG
Definition SharedDefines.h:1540
@ SPELL_HIT_TYPE_CRIT_DEBUG
Definition SharedDefines.h:1535
@ SMSG_SPELLNONMELEEDAMAGELOG
Definition Opcodes.h:622
bool physicalLog
Definition Unit.h:503
bool unused
Definition Unit.h:504

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, WorldObject::SendMessageToSet(), SMSG_SPELLNONMELEEDAMAGELOG, SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG, SPELL_HIT_TYPE_CRIT_DEBUG, SPELL_HIT_TYPE_HIT_DEBUG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by CalcAbsorbResist(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectEnvironmentalDMG(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and SendSpellNonMeleeDamageLog().

◆ SendSpellNonMeleeDamageLog() [2/2]

void Unit::SendSpellNonMeleeDamageLog ( Unit target,
SpellInfo const *  spellInfo,
uint32  Damage,
SpellSchoolMask  damageSchoolMask,
uint32  AbsorbedDamage,
uint32  Resist,
bool  PhysicalDamage,
uint32  Blocked,
bool  CriticalHit = false,
bool  Split = false 
)
6382{
6383 SpellNonMeleeDamage log(this, target, spellInfo, damageSchoolMask);
6384 log.damage = Damage;
6385 log.absorb = AbsorbedDamage;
6386 log.resist = Resist;
6387 log.physicalLog = PhysicalDamage;
6388 log.blocked = Blocked;
6389 log.HitInfo = 0;
6390 if (CriticalHit)
6391 {
6392 log.HitInfo |= SPELL_HIT_TYPE_CRIT;
6393 }
6394 if (Split)
6395 {
6396 log.HitInfo |= SPELL_HIT_TYPE_SPLIT;
6397 }
6399}
@ SPELL_HIT_TYPE_SPLIT
Definition SharedDefines.h:1538
Definition Unit.h:489

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, SpellNonMeleeDamage::damage, SpellNonMeleeDamage::HitInfo, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SendSpellNonMeleeDamageLog(), SPELL_HIT_TYPE_CRIT, and SPELL_HIT_TYPE_SPLIT.

◆ SendSpellNonMeleeReflectLog()

void Unit::SendSpellNonMeleeReflectLog ( SpellNonMeleeDamage log,
Unit attacker 
)
6302{
6303 // Xinef: function for players only, placed in unit because of cosmetics
6304 if (!IsPlayer())
6305 return;
6306
6307 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6308 // If we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our HP bar will not drop
6309 uint32 damage = log->damage;
6310 uint32 absorb = log->absorb;
6311 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6312 {
6313 absorb = damage;
6314 damage = 0;
6315 }
6316 data << log->target->GetPackGUID();
6317 data << attacker->GetPackGUID();
6318 data << uint32(log->spellInfo->Id);
6319 data << uint32(damage); // damage amount
6320 int32 overkill = damage - log->target->GetHealth();
6321 data << uint32(overkill > 0 ? overkill : 0); // overkill
6322 data << uint8 (log->schoolMask); // damage school
6323 data << uint32(absorb); // AbsorbedDamage
6324 data << uint32(log->resist); // resist
6325 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6326 data << uint8 (log->unused); // unused
6327 data << uint32(log->blocked); // blocked
6328 data << uint32(log->HitInfo);
6329 data << uint8 (0); // flag to use extend data
6330 ToPlayer()->SendDirectMessage(&data);
6331}

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, Player::SendDirectMessage(), SMSG_SPELLNONMELEEDAMAGELOG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by Spell::DoAllEffectOnTarget().

◆ SendTameFailure()

void Unit::SendTameFailure ( uint8  result)
20023{
20025 data << uint8(result);
20026 ToPlayer()->SendDirectMessage(&data);
20027}
@ SMSG_PET_TAME_FAILURE
Definition Opcodes.h:401

References Player::SendDirectMessage(), SMSG_PET_TAME_FAILURE, and Object::ToPlayer().

Referenced by spell_hun_tame_beast::CheckCast(), and Spell::CheckCast().

◆ SendTeleportPacket()

void Unit::SendTeleportPacket ( Position pos)
20030{
20032 if (IsCreature())
20033 Relocate(&pos);
20034 if (IsPlayer())
20035 {
20036 ToPlayer()->SetCanTeleport(true);
20037 }
20038 WorldPacket data2(MSG_MOVE_TELEPORT, 38);
20039 data2 << GetPackGUID();
20040 BuildMovementPacket(&data2);
20041 if (IsCreature())
20042 Relocate(&oldPos);
20043 if (IsPlayer())
20044 Relocate(&pos);
20045 SendMessageToSet(&data2, false);
20046}
@ MSG_MOVE_TELEPORT
Definition Opcodes.h:227

References BuildMovementPacket(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsCreature(), Object::IsPlayer(), MSG_MOVE_TELEPORT, Position::Relocate(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), and Object::ToPlayer().

Referenced by NearTeleportTo(), and Player::TeleportTo().

◆ SendThreatListUpdate()

void Unit::SendThreatListUpdate ( )
20102{
20103 if (!GetThreatMgr().isThreatListEmpty())
20104 {
20105 uint32 count = GetThreatMgr().GetThreatList().size();
20106
20107 //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
20108 WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
20109 data << GetPackGUID();
20110 data << uint32(count);
20112 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
20113 {
20114 data << (*itr)->getUnitGuid().WriteAsPacked();
20115 data << uint32((*itr)->GetThreat() * 100);
20116 }
20117 SendMessageToSet(&data, false);
20118 }
20119}
@ SMSG_THREAT_UPDATE
Definition Opcodes.h:1185

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), WorldObject::SendMessageToSet(), and SMSG_THREAT_UPDATE.

Referenced by Update().

◆ SetAI()

void Unit::SetAI ( UnitAI newAI)
inline
665{ i_AI = newAI; }

References i_AI.

◆ SetArmor()

void Unit::SetArmor ( int32  val)
inline

◆ SetAttackTime()

◆ setAttackTimer()

◆ SetAuraStack()

void Unit::SetAuraStack ( uint32  spellId,
Unit target,
uint32  stack 
)
18926{
18927 Aura* aura = target->GetAura(spellId, GetGUID());
18928 if (!aura)
18929 aura = AddAura(spellId, target);
18930 if (aura && stack)
18931 aura->SetStackAmount(stack);
18932}
void SetStackAmount(uint8 num)
Definition SpellAuras.cpp:995

References AddAura(), GetAura(), Object::GetGUID(), and Aura::SetStackAmount().

Referenced by boss_viscidus::DamageTaken(), spell_capacitus_polarity_charge::HandleTargets(), spell_thaddius_pos_neg_charge::HandleTargets(), and BattlefieldWG::OnPlayerJoinWar().

◆ SetBaseWeaponDamage()

void Unit::SetBaseWeaponDamage ( WeaponAttackType  attType,
WeaponDamageRange  damageRange,
float  value,
uint8  damageIndex = 0 
)
inline
1143{ m_weaponDamage[attType][damageRange][damageIndex] = value; }

References m_weaponDamage.

Referenced by Player::_ApplyWeaponDamage(), Guardian::InitStatsForLevel(), and Creature::SelectLevel().

◆ SetCanDualWield()

virtual void Unit::SetCanDualWield ( bool  value)
inlinevirtual

◆ SetCanFly()

bool Unit::SetCanFly ( bool  enable,
bool  packetOnly = false 
)
virtual

Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().

Doesn't inform the client.

Reimplemented in Player, and Creature.

20631{
20633 return false;
20634
20635 if (enable)
20636 {
20639 }
20640 else
20641 {
20643 }
20644
20645 return true;
20646}
@ MOVEMENTFLAG_CAN_FLY
Definition UnitDefines.h:389
@ MOVEMENTFLAG_MASK_MOVING_FLY
Definition UnitDefines.h:406
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:740

References AddUnitMovementFlag(), HasUnitMovementFlag(), MOVEMENTFLAG_CAN_FLY, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_MASK_MOVING_FLY, and RemoveUnitMovementFlag().

Referenced by AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_chapter5_light_of_dawn_aura::OnApply(), spell_chapter5_light_of_dawn_aura::OnRemove(), Player::SetCanFly(), and Creature::SetCanFly().

◆ SetCanModifyStats()

◆ SetCantProc()

void Unit::SetCantProc ( bool  apply)
17310{
17311 if (apply)
17312 ++m_procDeep;
17313 else
17314 {
17316 --m_procDeep;
17317 }
17318}

References ASSERT, and m_procDeep.

Referenced by HandleDummyAuraProc(), and ProcDamageAndSpellFor().

◆ SetCharm()

void Unit::SetCharm ( Unit target,
bool  apply 
)
Todo:
: maybe we can use this flag to check if controlled by player
10900{
10901 if (apply)
10902 {
10903 if (IsPlayer())
10904 {
10905 if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
10906 LOG_FATAL("entities.unit", "Player {} is trying to charm unit {}, but it already has a charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
10907
10908 charm->m_ControlledByPlayer = true;
10910 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10911 }
10912 else
10913 charm->m_ControlledByPlayer = false;
10914
10915 // PvP, FFAPvP
10916 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
10917
10918 if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
10919 LOG_FATAL("entities.unit", "Unit {} is being charmed, but it already has a charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
10920
10921 _isWalkingBeforeCharm = charm->IsWalking();
10923 {
10924 charm->SetWalk(false);
10925 charm->SendMovementFlagUpdate();
10926 }
10927
10928 m_Controlled.insert(charm);
10929 }
10930 else
10931 {
10932 if (IsPlayer())
10933 {
10934 if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
10935 LOG_FATAL("entities.unit", "Player {} is trying to uncharm unit {}, but it has another charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
10936 }
10937
10938 if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
10939 LOG_FATAL("entities.unit", "Unit {} is being uncharmed, but it has another charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
10940
10941 if (charm->IsPlayer())
10942 {
10943 charm->m_ControlledByPlayer = true;
10944 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10945 charm->ToPlayer()->UpdatePvPState();
10946 }
10947 else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
10948 {
10949 charm->m_ControlledByPlayer = true;
10950 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10951 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1));
10952
10953 // Xinef: skip controlled erase if charmed unit is owned by charmer
10954 if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION)))
10955 return;
10956 }
10957 else
10958 {
10959 charm->m_ControlledByPlayer = false;
10960 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10961 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
10962 }
10963
10964 if (charm->IsWalking() != _isWalkingBeforeCharm)
10965 {
10966 charm->SetWalk(_isWalkingBeforeCharm);
10967 charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
10968 }
10969
10970 m_Controlled.erase(charm);
10971 }
10972}
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:686
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition Object.cpp:704

References _isWalkingBeforeCharm, Object::AddGuidValue(), Object::GetByteValue(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), WorldObject::GetName(), HasUnitTypeMask(), IsDuringRemoveFromWorld(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), IsWalking(), LOG_FATAL, m_Controlled, m_ControlledByPlayer, Object::RemoveGuidValue(), RemoveUnitFlag(), SendMovementFlagUpdate(), Object::SetByteValue(), SetUnitFlag(), SetWalk(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), UNIT_FIELD_BYTES_2, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MASK_MINION, and Player::UpdatePvPState().

Referenced by RemoveCharmedBy(), SetCharmedBy(), and Player::StopCastingCharm().

◆ SetCharmedBy()

bool Unit::SetCharmedBy ( Unit charmer,
CharmType  type,
AuraApplication const *  aurApp = nullptr 
)
18374{
18375 if (!charmer)
18376 return false;
18377
18378 if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld())
18379 {
18380 return false;
18381 }
18382
18383 // dismount players when charmed
18384 if (IsPlayer())
18386
18387 if (charmer->IsPlayer())
18389
18390 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
18391 if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard
18392 throw 1;
18393 ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle());
18394
18395 LOG_DEBUG("entities.unit", "SetCharmedBy: charmer {} ({}), charmed {} ({}), type {}.",
18396 charmer->GetEntry(), charmer->GetGUID().ToString(), GetEntry(), GetGUID().ToString(), uint32(type));
18397
18398 if (this == charmer)
18399 {
18400 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Unit {} ({}) is trying to charm itself!", GetEntry(), GetGUID().ToString());
18401 return false;
18402 }
18403
18404 //if (HasUnitState(UNIT_STATE_UNATTACKABLE))
18405 // return false;
18406
18407 if (IsPlayer() && ToPlayer()->GetTransport())
18408 {
18409 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm {} ({})", GetEntry(), GetGUID().ToString());
18410 return false;
18411 }
18412
18413 // Already charmed
18414 if (GetCharmerGUID())
18415 {
18416 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) has already been charmed but {} ({}) is trying to charm it!",
18417 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
18418 return false;
18419 }
18420
18421 CastStop();
18422 AttackStop();
18423
18424 // Xinef: dont reset threat and combat, put them on offline list, moved down after faction changes
18425 // CombatStop(); /// @todo: CombatStop(true) may cause crash (interrupt spells)
18426 // DeleteThreatList();
18427
18428 Player* playerCharmer = charmer->ToPlayer();
18429
18430 // Charmer stop charming
18431 if (playerCharmer)
18432 {
18433 playerCharmer->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
18434 playerCharmer->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
18435 }
18436
18437 // Charmed stop charming
18438 if (IsPlayer())
18439 {
18440 ToPlayer()->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
18441 ToPlayer()->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
18442 }
18443
18444 // StopCastingCharm may remove a possessed pet?
18445 if (!IsInWorld())
18446 {
18447 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) is not in world but {} ({}) is trying to charm it!",
18448 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
18449 return false;
18450 }
18451
18452 // charm is set by aura, and aura effect remove handler was called during apply handler execution
18453 // prevent undefined behaviour
18454 if (aurApp && aurApp->GetRemoveMode())
18455 return false;
18456
18458 SetFaction(charmer->GetFaction());
18459
18460 // Set charmed
18461 charmer->SetCharm(this, true);
18462
18464
18465 if (IsCreature())
18466 {
18467 GetMotionMaster()->Clear(false);
18469 StopMoving();
18470
18471 if (charmer->IsPlayer() && charmer->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET_CHARM) && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON)
18472 {
18473 // Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
18474 Creature* charmed = ToCreature();
18475 charmed->NeedChangeAI = true;
18476 charmed->IsAIEnabled = false;
18477 }
18478 else
18479 {
18480 ToCreature()->AI()->OnCharmed(true);
18481 }
18482
18483 // Xinef: If creature can fly, add normal player flying flag (fixes speed)
18484 if (charmer->IsPlayer() && ToCreature()->CanFly())
18486 }
18487 else
18488 {
18489 Player* player = ToPlayer();
18490 if (player->isAFK())
18491 player->ToggleAFK();
18492
18493 player->SetClientControl(this, false); // verified
18494 }
18495
18496 // charm is set by aura, and aura effect remove handler was called during apply handler execution
18497 // prevent undefined behaviour
18498 if (aurApp && aurApp->GetRemoveMode())
18499 return false;
18500
18501 // Pets already have a properly initialized CharmInfo, don't overwrite it.
18502 // Xinef: I need charmInfo for vehicle
18503 if (/*type != CHARM_TYPE_VEHICLE &&*/ !GetCharmInfo())
18504 {
18505 InitCharmInfo();
18506 if (type == CHARM_TYPE_POSSESS)
18508 else if (type != CHARM_TYPE_VEHICLE)
18509 {
18511
18512 // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers
18513 if (type == CHARM_TYPE_CONVERT && IsCreature())
18515 }
18516 }
18517
18518 if (playerCharmer)
18519 {
18520 switch (type)
18521 {
18522 case CHARM_TYPE_VEHICLE:
18525 playerCharmer->SetClientControl(this, true); // verified
18526 playerCharmer->VehicleSpellInitialize();
18527 break;
18528 case CHARM_TYPE_POSSESS:
18533 playerCharmer->SetClientControl(this, true); // verified
18534 playerCharmer->PossessSpellInitialize();
18535 break;
18536 case CHARM_TYPE_CHARM:
18538 {
18540 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
18541 {
18542 // to prevent client crash
18544
18545 // just to enable stat window
18546 if (GetCharmInfo())
18547 GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
18548
18549 // if charmed two demons the same session, the 2nd gets the 1st one's name
18550 SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped
18551 }
18552 }
18553 if (playerCharmer->m_seer != this)
18554 {
18556 playerCharmer->CharmSpellInitialize();
18557 }
18558 break;
18559 default:
18560 break;
18561 }
18562 }
18563 else if (IsPlayer())
18565
18566 if (Creature* creature = ToCreature())
18567 creature->RefreshSwimmingFlag();
18568
18569 if (IsPlayer())
18570 sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction());
18571
18572 return true;
18573}
@ CHARM_TYPE_CONVERT
Definition CharmInfo.h:48
@ REACT_DEFENSIVE
Definition Unit.h:549
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition UpdateFields.h:133
void OnCharmed(bool apply) override
Called when unit is charmed.
Definition CreatureAI.cpp:33
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:94
void MoveIdle()
Definition MotionMaster.cpp:232
void CharmSpellInitialize()
Definition Player.cpp:9675
WorldObject * m_seer
Definition Player.h:2337
void ToggleAFK()
Definition Player.cpp:1293
void PossessSpellInitialize()
Definition Player.cpp:9572
bool isAFK() const
Definition Player.h:1151
void VehicleSpellInitialize()
Definition Player.cpp:9600
void StopCastingBindSight(Aura *except=nullptr)
Definition Player.cpp:13191
virtual float GetFollowAngle() const
Definition Unit.h:1806
CharmInfo * InitCharmInfo()
Definition Unit.cpp:15834
void InitPossessCreateSpells()
Definition CharmInfo.cpp:77
void InitCharmCreateSpells()
Definition CharmInfo.cpp:98

References _oldFactionId, AddUnitMovementFlag(), AddUnitState(), Creature::AI(), ASSERT, AttackStop(), CanFly(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_CONVERT, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, Player::CharmSpellInitialize(), CLASS_CONTEXT_PET_CHARM, CLASS_MAGE, CLASS_WARLOCK, MotionMaster::Clear(), CREATURE_TYPE_DEMON, AuraApplication::GetBase(), GetCharmerGUID(), GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFaction(), GetFollowAngle(), GameTime::GetGameTime(), Object::GetGUID(), Object::GetGUID(), GetMotionMaster(), AuraApplication::GetRemoveMode(), WorldObject::GetTransport(), CharmInfo::InitCharmCreateSpells(), InitCharmInfo(), CharmInfo::InitPossessCreateSpells(), Player::isAFK(), IsAIEnabled, IsClass(), Object::IsCreature(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Object::IsPlayer(), IsVehicle(), LOG_DEBUG, LOG_FATAL, Player::m_seer, MotionMaster::MoveFollow(), MotionMaster::MoveIdle(), MOVEMENTFLAG_FLYING, NeedChangeAI, CreatureAI::OnCharmed(), PET_FOLLOW_DIST, Player::PossessSpellInitialize(), REACT_DEFENSIVE, RemoveAurasByType(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), Creature::SetReactState(), SetUInt32Value(), SetUnitFlag(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sScriptMgr, StopAttackingInvalidTarget(), Player::StopCastingBindSight(), Player::StopCastingCharm(), StopMoving(), Object::ToCreature(), Player::ToggleAFK(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), CreatureTemplate::type, UNIT_FIELD_BYTES_0, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, and Player::VehicleSpellInitialize().

Referenced by Vehicle::AddPassenger(), AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), and Puppet::InitSummon().

◆ SetCharmerGUID()

void Unit::SetCharmerGUID ( ObjectGuid  owner)
inline

◆ SetCombatTimer()

void Unit::SetCombatTimer ( uint32  timer)
inline
901{ m_CombatTimer = timer; }

References m_CombatTimer.

◆ SetConfused()

void Unit::SetConfused ( bool  apply)
protected
18342{
18343 if (apply)
18344 {
18345 SetTarget();
18347 }
18348 else
18349 {
18350 if (IsAlive())
18351 {
18352 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == CONFUSED_MOTION_TYPE)
18353 {
18355 StopMoving();
18356 }
18357
18358 if (GetVictim())
18360 }
18361 }
18362
18363 // xinef: block / allow control to real mover (eg. charmer)
18364 if (IsPlayer())
18365 {
18366 if (m_movedByPlayer)
18367 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
18368 //else
18369 // ToPlayer()->SetClientControl(this, !apply);
18370 }
18371}
@ CONFUSED_MOTION_TYPE
Definition MotionMaster.h:44
void MoveConfused()
Enable the confusion movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:292

References CONFUSED_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveConfused(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), StopMoving(), and Object::ToPlayer().

Referenced by SetControlled().

◆ SetContestedPvP()

void Unit::SetContestedPvP ( Player attackedPlayer = nullptr,
bool  lookForNearContestedGuards = true 
)
17272{
17274
17275 if (!player || ((attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->Opponent == attackedPlayer))) || player->InBattleground()))
17276 return;
17277
17278 // check if there any guards that should care about the contested flag on player
17279 if (lookForNearContestedGuards)
17280 {
17281 std::list<Unit*> targets;
17284 Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS);
17285
17286 // return if there are no contested guards found
17287 if (!targets.size())
17288 {
17289 return;
17290 }
17291 }
17292
17293 player->SetContestedPvPTimer(30000);
17295 {
17298 // call MoveInLineOfSight for nearby contested guards
17300 }
17302 {
17304 // call MoveInLineOfSight for nearby contested guards
17306 }
17307}
#define MAX_AGGRO_RADIUS
Definition Unit.h:43
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:1126
bool InBattleground() const
Definition Player.h:2255
void SetContestedPvPTimer(uint32 newTime)
Definition Player.h:1872

References WorldObject::AddToNotify(), AddUnitState(), Player::duel, GetCharmerOrOwnerPlayerOrPlayerItself(), HasUnitState(), Player::InBattleground(), MAX_AGGRO_RADIUS, NOTIFY_AI_RELOCATION, PLAYER_FLAGS_CONTESTED_PVP, Player::SetContestedPvPTimer(), Player::SetPlayerFlag(), UNIT_STATE_ATTACK_PLAYER, and Cell::VisitAllObjects().

Referenced by CombatStart(), CombatStartOnCast(), Spell::DoSpellHitOnUnit(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetControlled()

void Unit::SetControlled ( bool  apply,
UnitState  state,
Unit source = nullptr,
bool  isFear = false 
)
18058{
18059 if (apply)
18060 {
18061 if (HasUnitState(state))
18062 return;
18063
18064 AddUnitState(state);
18065 switch (state)
18066 {
18067 case UNIT_STATE_STUNNED:
18068 SetStunned(true);
18069 break;
18070 case UNIT_STATE_ROOT:
18072 SetRooted(true);
18073 break;
18076 {
18079 // SendAutoRepeatCancel ?
18080 SetConfused(true);
18081 CastStop(0, false);
18082 }
18083 break;
18084 case UNIT_STATE_FLEEING:
18086 {
18089 // SendAutoRepeatCancel ?
18090 SetFeared(true, source, isFear);
18091 CastStop(0, false);
18092 }
18093 break;
18094 default:
18095 break;
18096 }
18097
18098 if (IsPlayer())
18099 {
18100 sScriptMgr->AnticheatSetRootACKUpd(ToPlayer());
18101 }
18102 }
18103 else
18104 {
18105 // xinef: moved from below, checked all SetX functions, no calls to currently modified state
18106 // xinef: added to each case because of return
18107 //ClearUnitState(state);
18108
18109 switch (state)
18110 {
18111 case UNIT_STATE_STUNNED:
18112 if (HasStunAura())
18113 return;
18114 ClearUnitState(state);
18115 SetStunned(false);
18116 break;
18117 case UNIT_STATE_ROOT:
18118 // Prevent creature_template_movement rooted flag from being removed on aura expiration.
18119 if (IsCreature())
18120 {
18121 if (ToCreature()->GetCreatureTemplate()->Movement.Rooted)
18122 {
18123 return;
18124 }
18125 }
18126
18127 if (HasRootAura() || GetVehicle())
18128 return;
18129 ClearUnitState(state);
18130 SetRooted(false);
18131 break;
18133 if (HasConfuseAura())
18134 return;
18135 ClearUnitState(state);
18136 SetConfused(false);
18137 break;
18138 case UNIT_STATE_FLEEING:
18139 if (HasFearAura())
18140 return;
18141 ClearUnitState(state);
18142 SetFeared(false);
18143 break;
18144 default:
18145 return;
18146 }
18147
18148 //ClearUnitState(state);
18149
18151 SetStunned(true);
18152 else
18153 {
18155 SetRooted(true);
18156
18158 SetConfused(true);
18160 {
18161 bool isFear = false;
18162 if (HasFearAura())
18163 {
18164 isFear = true;
18165 source = ObjectAccessor::GetUnit(*this, GetAuraEffectsByType(SPELL_AURA_MOD_FEAR).front()->GetCasterGUID());
18166 }
18167
18168 if (!source)
18169 {
18170 source = getAttackerForHelper();
18171 }
18172
18173 SetFeared(true, source, isFear);
18174 }
18175 }
18176 }
18177}
void SetFeared(bool apply, Unit *fearedBy=nullptr, bool isFear=false)
Definition Unit.cpp:18309
bool HasStunAura() const
Definition Unit.h:1750
void SetConfused(bool apply)
Definition Unit.cpp:18341
void SetStunned(bool apply)
Definition Unit.cpp:18179
Unit * getAttackerForHelper() const
Definition Unit.cpp:740
bool HasConfuseAura() const
Definition Unit.h:1748
void SetRooted(bool apply, bool isStun=false)
Definition Unit.cpp:18227
bool HasRootAura() const
Definition Unit.h:1749
bool HasFearAura() const
Definition Unit.h:1747
Definition Unit.h:257

References AddUnitState(), CastStop(), ClearUnitState(), getAttackerForHelper(), GetAuraEffectsByType(), ObjectAccessor::GetUnit(), GetVehicle(), HasConfuseAura(), HasFearAura(), HasRootAura(), HasStunAura(), HasUnitState(), Object::IsCreature(), Object::IsPlayer(), SendMeleeAttackStop(), SetConfused(), SetFeared(), SetRooted(), SetStunned(), SPELL_AURA_MOD_FEAR, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, UNIT_STATE_MELEE_ATTACKING, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by _ExitVehicle(), Vehicle::AddPassenger(), boss_ahune::boss_ahune(), boss_ouro::boss_ouro(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_akama_illidan::DoAction(), Creature::DoFleeToGetAssistance(), boss_skeram::DoTeleport(), CritterAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_falric::boss_falricAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_noth::boss_nothAI::EnterEvadeMode(), boss_thaddius_summon::boss_thaddius_summonAI::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::boss_ignisAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), boss_ingvar_the_plunderer::EnterEvadeMode(), boss_svala::boss_svalaAI::EnterEvadeMode(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_shirrak_the_dead_watcher::EnterEvadeMode(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleAuraModRoot(), AuraEffect::HandleAuraModStun(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_gen_visual_dummy_stun::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_gen_visual_dummy_stun::HandleEffectRemove(), AuraEffect::HandleModConfuse(), AuraEffect::HandleModFear(), AuraEffect::HandlePreventFleeing(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_volazj::JustDied(), CritterAI::JustEngagedWith(), boss_skadi::boss_skadiAI::JustEngagedWith(), boss_shirrak_the_dead_watcher::JustEngagedWith(), boss_skeram::JustSummoned(), npc_twilight_volunteer::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_illidan_stormrage::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_gunship_gunner::npc_gunship_gunnerAI::MovementInform(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_iron_watcher::npc_iron_watcherAI::MovementInform(), npc_buru_egg::npc_buru_egg(), npc_icc_blood_beast::npc_icc_blood_beastAI::npc_icc_blood_beastAI(), npc_raging_spirit::npc_raging_spiritAI::npc_raging_spiritAI(), npc_vengeful_shade::npc_vengeful_shadeAI::npc_vengeful_shadeAI(), spell_systems_shutdown_aura::OnApply(), spell_systems_shutdown_aura::OnRemove(), npc_akama_illidan::PathEndReached(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_skeram::Reset(), boss_volazj::Reset(), npc_twilight_summon::npc_twilight_summonAI::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_thaddius_summon::boss_thaddius_summonAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_ignis::boss_ignisAI::Reset(), boss_thorim_pillar::boss_thorim_pillarAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_ingvar_the_plunderer::Reset(), boss_palehoof::boss_palehoofAI::Reset(), boss_skadi::boss_skadiAI::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_iron_watcher::npc_iron_watcherAI::Reset(), boss_shirrak_the_dead_watcher::Reset(), boss_illidan_stormrage::Reset(), npc_akama_illidan::Reset(), npc_target_dummy::npc_target_dummyAI::Reset(), boss_illidan_stormrage::ScheduleAbilities(), Player::SetClientControl(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_noth::boss_nothAI::StartGroundPhase(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), boss_skeram::UpdateAI(), boss_volazj::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), npc_icc_blood_beast::npc_icc_blood_beastAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), boss_ingvar_the_plunderer::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ SetCreateHealth()

◆ SetCreateMana()

◆ SetCreateStat()

void Unit::SetCreateStat ( Stats  stat,
float  val 
)
inline

◆ SetCreatorGUID()

◆ SetCritterGUID()

void Unit::SetCritterGUID ( ObjectGuid  guid)
inline

◆ SetCurrentCastedSpell()

void Unit::SetCurrentCastedSpell ( Spell pSpell)
3958{
3959 ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
3960
3961 CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
3962
3963 if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
3964 return;
3965
3966 bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
3967
3968 // break same type spell if it is not delayed
3969 InterruptSpell(CSpellType, false, true, bySelf);
3970
3971 // special breakage effects:
3972 switch (CSpellType)
3973 {
3975 {
3976 // generic spells always break channeled not delayed spells
3978 {
3979 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3980 {
3982 }
3983 }
3984
3985 // autorepeat breaking
3987 {
3988 // break autorepeat if not Auto Shot
3989 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3991 m_AutoRepeatFirstCast = true;
3992 }
3993
3994 // melee spells breaking
3996 {
3997 // break melee spells if cast time
3998 if (pSpell->GetCastTime() > 0)
3999 {
4001 }
4002 }
4003 if (pSpell->GetCastTime() > 0)
4005
4006 break;
4007 }
4009 {
4010 // channel spells always break generic non-delayed and any channeled spells
4012 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4013
4014 // it also does break autorepeat if not Auto Shot
4016 m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
4019
4020 break;
4021 }
4023 {
4024 // only Auto Shoot does not break anything
4025 if (pSpell->m_spellInfo->Id != 75)
4026 {
4027 // generic autorepeats break generic non-delayed and channeled non-delayed spells
4029 {
4030 if (!s->GetSpellInfo()->IsActionAllowedChannel())
4031 {
4033 }
4034 }
4035
4037 }
4038 // special action: set first cast flag
4039 m_AutoRepeatFirstCast = true;
4040
4041 break;
4042 }
4043
4044 default:
4045 // other spell types don't break anything now
4046 break;
4047 }
4048
4049 // current spell (if it is still here) may be safely deleted now
4050 if (m_currentSpells[CSpellType])
4051 m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
4052
4053 // set new current spell
4054 m_currentSpells[CSpellType] = pSpell;
4055 pSpell->SetReferencedFromCurrent(true);
4056
4057 pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
4058}
CurrentSpellTypes GetCurrentContainer() const
Definition Spell.cpp:7916
Spell ** m_selfContainer
Definition Spell.h:614

References AddUnitState(), ASSERT, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, CURRENT_MELEE_SPELL, Spell::GetCastTime(), Spell::GetCurrentContainer(), GetCurrentSpell(), SpellInfo::Id, InterruptSpell(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_selfContainer, Spell::m_spellInfo, Spell::SetReferencedFromCurrent(), and UNIT_STATE_CASTING.

Referenced by Spell::prepare().

◆ setDeathState()

void Unit::setDeathState ( DeathState  s,
bool  despawn = false 
)
virtual

Reimplemented in Creature, Minion, Pet, and Player.

14577{
14578 // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
14579 // it can be used to check creation of death items (such as soul shards).
14580 m_deathState = s;
14581
14583 {
14584 CombatStop();
14587 ClearComboPointHolders(); // any combo points pointed to unit lost at it death
14588
14589 if (IsNonMeleeSpellCast(false))
14591
14592 UnsummonAllTotems(true);
14593 RemoveAllControlled(true);
14595 }
14596
14597 if (s == DeathState::JustDied)
14598 {
14599 // remove aurastates allowing special moves
14602
14603 GetMotionMaster()->Clear(false);
14605
14606 // Xinef: Remove Hover so the corpse can fall to the ground
14607 SetHover(false);
14608
14609 if (despawn)
14610 DisableSpline();
14611 else
14612 StopMoving();
14613
14614 // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
14615 // do not why since in IncreaseMaxHealth currenthealth is checked
14616 SetHealth(0);
14617 SetPower(getPowerType(), 0);
14618
14619 // Stop emote on death
14621
14622 // players in instance don't have ZoneScript, but they have InstanceScript
14624 zoneScript->OnUnitDeath(this);
14625 }
14626 else if (s == DeathState::JustRespawned)
14627 {
14628 RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
14629 }
14630}
@ UNIT_FLAG_SKINNABLE
Definition UnitDefines.h:276
void ClearAllReactives()
Definition Unit.cpp:16950
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition Unit.cpp:20696
void ClearDiminishings()
Definition Unit.h:1773
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1203
ZoneScript * GetZoneScript() const
Definition Object.h:542
Definition ZoneScript.h:26

References Alive, MotionMaster::Clear(), ClearAllReactives(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearDiminishings(), CombatStop(), HostileRefMgr::deleteReferences(), DisableSpline(), getHostileRefMgr(), WorldObject::GetInstanceScript(), GetMotionMaster(), getPowerType(), GetThreatMgr(), WorldObject::GetZoneScript(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), JustDied, JustRespawned, m_deathState, MotionMaster::MoveIdle(), RemoveAllAurasOnDeath(), RemoveAllControlled(), Object::RemoveFlag(), SetHealth(), SetHover(), SetPower(), SetUInt32Value(), StopMoving(), UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE, UNIT_NPC_EMOTESTATE, and UnsummonAllTotems().

Referenced by _ExitVehicle(), KillMagnetEvent::Execute(), Spell::finish(), WorldSession::HandlePetActionHelper(), AuraEffect::HandleSpiritOfRedemption(), Kill(), Creature::setDeathState(), and Player::setDeathState().

◆ SetDisableGravity()

bool Unit::SetDisableGravity ( bool  disable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
virtual

◆ SetDisplayId()

◆ SetExtraUnitMovementFlags()

void Unit::SetExtraUnitMovementFlags ( uint16  f)
inline

◆ SetFacingTo()

void Unit::SetFacingTo ( float  ori)
20551{
20552 Movement::MoveSplineInit init(this);
20553 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
20555 init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
20556 init.SetFacing(ori);
20557 init.Launch();
20558}
ObjectGuid GetTransGUID() const override
Definition Unit.cpp:18779

References Movement::MoveSplineInit::DisableTransportPathTransformations(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTransGUID(), HasUnitMovementFlag(), Movement::MoveSplineInit::Launch(), MOVEMENTFLAG_ONTRANSPORT, Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_twinemperorsAI::DoAction(), npc_arthas::npc_arthasAI::DoAction(), Spell::EffectDistract(), UtherBatteredHiltEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), DistractMovementGenerator::Finalize(), Creature::FocusTarget(), spell_item_unusual_compass::HandleDummy(), spell_drakkari_colossus_face_me::HandleScriptEffect(), boss_grand_warlock_nethekurse::IntroRP(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), boss_ragnaros::boss_ragnarosAI::JustDied(), boss_ingvar_the_plunderer::JustSummoned(), boss_nalorakk::MoveInLineOfSight(), boss_algalon_the_observer::boss_algalon_the_observerAI::MovementInform(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::MovementInform(), boss_zuljin::MovementInform(), npc_harrison_jones::MovementInform(), boss_onyxia::MovementInform(), npc_twilight_volunteer::MovementInform(), boss_eadric::boss_eadricAI::MovementInform(), boss_paletress::boss_paletressAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_enslaved_proto_drake::MovementInform(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::MovementInform(), boss_illidan_stormrage::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), boss_felmyst::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), spell_lurker_below_spout::OnPeriodic(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), SmartAI::PausePath(), SmartScript::ProcessAction(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_illidan_stormrage::ScheduleAbilities(), boss_nightbane::ScheduleFly(), Player::SetClientControl(), boss_grand_warlock_nethekurse::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_chesspiece::SpellHitTarget(), boss_heigan::boss_heiganAI::StartFightPhase(), CreatureAI::TriggerAlert(), RotateMovementGenerator::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), boss_onyxia::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_general_andorov::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), npc_argent_soldier::npc_argent_soldierAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetFacingToObject()

void Unit::SetFacingToObject ( WorldObject object)
Todo:
figure out under what conditions creature will move towards object instead of facing it where it currently is.
20561{
20562 // never face when already moving
20563 if (!IsStopped())
20564 return;
20565
20567 Movement::MoveSplineInit init(this);
20568 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
20569 init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
20570 init.Launch();
20571}
bool IsStopped() const
Definition Unit.h:1674

References Position::GetAngle(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsStopped(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), npc_ranshalla::npc_ranshallaAI::DoChannelTorchSpell(), spell_yogg_saron_target_selectors::HandleScript(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_maiev_illidan::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), boss_illidan_stormrage::JustSummoned(), npc_drakuru_shackles::npc_drakuru_shacklesAI::LockRageclaw(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), boss_zuljin::MovementInform(), npc_harrison_jones::MovementInform(), npc_akama_illidan::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_nightbane::ScheduleFly(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), boss_the_lurker_below::SchedulerPhaseOne(), boss_shade_of_aran::SetGUID(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::SetGUID(), npc_harrison_jones::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_death_knight_initiate::npc_death_knight_initiateAI::SpellHit(), npc_forest_frog::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_magister_aledis::StartFight(), boss_hydross_the_unstable::SummonMovementInform(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_pilgrims_bounty_chair::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_hidden_cultist::npc_hidden_cultistAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_scarlet_miner::npc_scarlet_minerAI::WaypointReached(), and npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached().

◆ SetFaction()

void Unit::SetFaction ( uint32  faction)
10080{
10082 if (IsCreature())
10084}
void UpdateMoveInLineOfSightState()
Definition Creature.cpp:2588

References Object::IsCreature(), SetUInt32Value(), Object::ToCreature(), UNIT_FIELD_FACTIONTEMPLATE, and Creature::UpdateMoveInLineOfSightState().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_hidden_cultist::npc_hidden_cultistAI::AttackPlayer(), GameObject::CastSpell(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_kalecgos::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSummonType(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::EnterEvadeMode(), BattlegroundEY::EventTeamCapturedPoint(), AuraEffect::HandleAuraModFaction(), BattlegroundIC::HandleCapturedNodes(), spell_q12096_q12092_dummy::HandleDummy(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), spell_mutate_explode_bug::HandleOnHit(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_item_draenic_pale_ale::HandleSummon(), npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_general_andorov::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), Minion::InitStats(), TempSummon::InitStats(), InitTamedPet(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), FollowerAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_volkhan::boss_volkhanAI::JustSummoned(), boss_balinda::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), Pet::LoadPetFromDB(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), boss_twilight_corrupter::MoveInLineOfSight(), npc_akama_shade::MovementInform(), BattlegroundAB::NodeOccupied(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), spell_brewfest_reveler_transform::OnApply(), npc_chesspiece::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), boss_azuregos::OnGossipSelect(), npc_prospector_remtravel::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), BattlegroundAV::PopulateNode(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), RemoveCharmedBy(), boss_doomrel::boss_doomrelAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_coren_direbrew::Reset(), npc_direbrew_minion::Reset(), npc_aquementas::npc_aquementasAI::Reset(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), npc_captured_rageclaw::npc_captured_rageclawAI::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), RestoreFaction(), SetCharmedBy(), Player::SetFactionForRace(), Player::SetGameMaster(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), BattlegroundIC::SetupBattleground(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::SpawnCreature(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), FollowerAI::StartFollow(), pyrewood_ambush::pyrewood_ambushAI::SummonCreatureWithRandomTarget(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), Spell::SummonGuardian(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), WorldObject::SummonTrigger(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_magister_aledis::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), Creature::UpdateEntry(), npc_magwin::npc_magwinAI::UpdateEscortAI(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ SetFeared()

void Unit::SetFeared ( bool  apply,
Unit fearedBy = nullptr,
bool  isFear = false 
)
protected
18310{
18311 if (apply)
18312 {
18313 SetTarget();
18314 GetMotionMaster()->MoveFleeing(fearedBy, isFear ? 0 : sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
18315 }
18316 else
18317 {
18318 if (IsAlive())
18319 {
18320 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE)
18321 {
18323 StopMoving();
18324 }
18325
18326 if (GetVictim())
18328 }
18329 }
18330
18331 // xinef: block / allow control to real mover (eg. charmer)
18332 if (IsPlayer())
18333 {
18334 if (m_movedByPlayer)
18335 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
18336 //else
18337 // ToPlayer()->SetClientControl(this, !apply);
18338 }
18339}
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition IWorld.h:285
@ FLEEING_MOTION_TYPE
Definition MotionMaster.h:49
void MoveFleeing(Unit *enemy, uint32 time=0)
Enable the target's fleeing movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:746

References CONFIG_CREATURE_FAMILY_FLEE_DELAY, FLEEING_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), MotionMaster::GetMotionSlotType(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveFleeing(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), StopMoving(), sWorld, and Object::ToPlayer().

Referenced by SetControlled().

◆ SetFeatherFall()

bool Unit::SetFeatherFall ( bool  enable,
bool  packetOnly = false 
)
virtual

Reimplemented in Player, and Creature.

20675{
20677 return false;
20678
20679 if (enable)
20681 else
20683
20684 return true;
20685}
@ MOVEMENTFLAG_FALLING_SLOW
Definition UnitDefines.h:394

References AddUnitMovementFlag(), HasUnitMovementFlag(), MOVEMENTFLAG_FALLING_SLOW, and RemoveUnitMovementFlag().

Referenced by AuraEffect::HandleAuraFeatherFall(), debug_commandscript::HandleDebugMoveflagsCommand(), Player::SetFeatherFall(), and Creature::SetFeatherFall().

◆ SetFullHealth()

◆ SetHealth()

void Unit::SetHealth ( uint32  val)
15502{
15504 val = 0;
15505 else if (IsPlayer() && getDeathState() == DeathState::Dead)
15506 val = 1;
15507 else
15508 {
15509 uint32 maxHealth = GetMaxHealth();
15510 if (maxHealth < val)
15511 val = maxHealth;
15512 }
15513
15514 float prevHealthPct = GetHealthPct();
15515
15517
15518 // mobs that are now or were below 30% need to update their speed
15519 if (IsCreature() && !(IsPet() && ToPet()->isControlled() && IsControlledByPlayer()) && (prevHealthPct < 30.0 || HealthBelowPct(30)))
15520 {
15521 UpdateSpeed(MOVE_RUN, false);
15522 }
15523
15524 // group update
15525 if (IsPlayer())
15526 {
15527 Player* player = ToPlayer();
15528 if (player->NeedSendSpectatorData())
15530
15531 if (player->GetGroup())
15533 }
15534 else if (Pet* pet = ToCreature()->ToPet())
15535 {
15536 if (pet->isControlled())
15537 {
15538 if (Unit* owner = GetOwner())
15539 if (Player* player = owner->ToPlayer())
15540 {
15541 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
15542 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
15543
15544 if (player->GetGroup())
15546 }
15547 }
15548 }
15549}
@ GROUP_UPDATE_FLAG_CUR_HP
Definition Group.h:101
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition Group.h:113
bool NeedSendSpectatorData() const
Definition Player.cpp:15432
void SetGroupUpdateFlag(uint32 flag)
Definition Player.h:2477
float GetHealthPct() const
Definition Unit.h:1037
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, const char *prefix, uint32 t)
Definition ArenaSpectator.h:62

References Dead, WorldObject::FindMap(), getDeathState(), Player::GetGroup(), Object::GetGUID(), GetHealthPct(), GetMaxHealth(), GetOwner(), GROUP_UPDATE_FLAG_CUR_HP, GROUP_UPDATE_FLAG_PET_CUR_HP, HealthBelowPct(), IsControlledByPlayer(), Object::IsCreature(), IsPet(), Object::IsPlayer(), JustDied, MOVE_RUN, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_HEALTH, and UpdateSpeed().

Referenced by boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), Player::BuildPlayerRepop(), npc_mograine::npc_mograineAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_alar::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), DealDamage(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_oculus_soar_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyHPCommand(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcSetLevelCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), npc_echo_of_medivh::HandlePieceJustDied(), spell_stinky_precious_decimate::HandleScript(), spell_ahune_synch_health::HandleScript(), AuraEffect::HandleSpiritOfRedemption(), npc_pet_pri_lightwell::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustReachedHome(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustReachedHome(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Player::ProcessDelayedOperations(), boss_vaelastrasz::boss_vaelAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetAllPowers(), Player::RestoreHealthAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetFullHealth(), SetMaxHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ SetHover()

bool Unit::SetHover ( bool  enable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
virtual

Reimplemented in Creature, and Player.

20697{
20699 return false;
20700
20701 float hoverHeight = GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
20702
20703 if (enable)
20704 {
20706 if (hoverHeight && GetPositionZ() - GetFloorZ() < hoverHeight)
20707 UpdateHeight(GetPositionZ() + hoverHeight);
20708 }
20709 else
20710 {
20712 if (hoverHeight && (!isDying() || !IsCreature()))
20713 {
20714 float newZ = std::max<float>(GetFloorZ(), GetPositionZ() - hoverHeight);
20716 UpdateHeight(newZ);
20717 }
20718 SendMovementFlagUpdate(); // pussywizard: needed for falling after death (instead of falling onto air at hover height)
20719 }
20720
20721 return true;
20722}
void UpdateHeight(float newZ)
Only server-side height update, does not broadcast to client.
Definition Unit.cpp:20094
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:16727
bool isDying() const
Definition Unit.h:1705
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition Object.cpp:1565
float GetFloorZ() const
Definition Object.cpp:3148

References AddUnitMovementFlag(), Object::GetFloatValue(), WorldObject::GetFloorZ(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), HasUnitMovementFlag(), Object::IsCreature(), isDying(), MOVEMENTFLAG_HOVER, RemoveUnitMovementFlag(), SendMovementFlagUpdate(), UNIT_FIELD_HOVERHEIGHT, WorldObject::UpdateAllowedPositionZ(), and UpdateHeight().

Referenced by AuraEffect::HandleAuraHover(), debug_commandscript::HandleDebugMoveflagsCommand(), setDeathState(), Creature::SetHover(), and Player::SetHover().

◆ SetImmuneToAll()

void Unit::SetImmuneToAll ( bool  apply,
bool  keepCombat = false 
)
inline
880{ SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); }
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:13643

References SetImmuneToNPC(), and SetImmuneToPC().

Referenced by spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), boss_chromaggus::boss_chromaggusAI::boss_chromaggusAI(), boss_nalorakk::boss_nalorakk(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_broggok::DoAction(), boss_grand_warlock_nethekurse::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_ambassador_hellmaw::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonType(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), spell_uldaman_stoned_aura::HandleEffectApply(), spell_uldaman_stoned_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_item_draenic_pale_ale::HandleSummon(), boss_majordomo::boss_majordomoAI::InitializeAI(), boss_felblood_kaelthas::InitializeAI(), boss_captain_skarloc::InitializeAI(), boss_taldaram::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), Player::InitStatsForLevel(), boss_falric::boss_falricAI::JustEngagedWith(), boss_marwyn::boss_marwynAI::JustEngagedWith(), boss_moroes::JustEngagedWith(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_rinji::npc_rinjiAI::JustRespawned(), npc_isla_starmane::npc_isla_starmaneAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), boss_felblood_kaelthas::MoveInLineOfSight(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), boss_captain_skarloc::MovementInform(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), npc_enslaved_proto_drake::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_rinji::npc_rinjiAI::npc_rinjiAI(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_felblood_kaelthas::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_skeram::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_marwyn::boss_marwynAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), boss_svala::boss_svalaAI::Reset(), npc_thassarian::npc_thassarianAI::Reset(), boss_ambassador_hellmaw::Reset(), boss_broggok::Reset(), boss_grand_warlock_nethekurse::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_svala::boss_svalaAI::SetData(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_chromaggus::boss_chromaggusAI::SetGUID(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_rinji::npc_rinjiAI::sQuestAccept(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_skeram::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_anzu::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ SetImmuneToNPC()

void Unit::SetImmuneToNPC ( bool  apply,
bool  keepCombat = false 
)

◆ SetImmuneToPC()

void Unit::SetImmuneToPC ( bool  apply,
bool  keepCombat = false 
)
13635{
13636 (void)keepCombat;
13637 if (apply)
13639 else
13641}

References RemoveUnitFlag(), SetUnitFlag(), and UNIT_FLAG_IMMUNE_TO_PC.

Referenced by boss_victor_nefarius::boss_victor_nefariusAI::BeginEvent(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), ClearInCombat(), npc_magister_aledis::DamageTaken(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_frozen_core::DoAction(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectRemove(), boss_blackheart_the_inciter::JustEngagedWith(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_omen::npc_omenAI::npc_omenAI(), npc_death_knight_initiate::OnGossipSelect(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), npc_kaya_flathoof::OnQuestAccept(), boss_doomrel::boss_doomrelAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_julianne::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_a_special_surprise::npc_a_special_surpriseAI::Reset(), npc_coren_direbrew::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), boss_blackheart_the_inciter::Reset(), boss_magtheridon::Reset(), npc_magister_aledis::Reset(), boss_magtheridon::ScheduleCombatEvents(), SetImmuneToAll(), SetInCombatState(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_magister_aledis::UpdateAI(), and npc_tallhorn_stag::npc_tallhorn_stagAI::UpdateAI().

◆ SetInCombatState()

void Unit::SetInCombatState ( bool  PvP,
Unit enemy = nullptr,
uint32  duration = 0 
)
13756{
13757 // only alive units can be in combat
13758 if (!IsAlive())
13759 return;
13760
13761 if (PvP)
13762 m_CombatTimer = std::max<uint32>(GetCombatTimer(), std::max<uint32>(5500, duration));
13763 else if (duration)
13764 m_CombatTimer = std::max<uint32>(GetCombatTimer(), duration);
13765
13767 return;
13768
13769 // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back
13770 if (IsCreature() && enemy && IsImmuneToPC() && enemy->GetCharmerOrOwnerPlayerOrPlayerItself())
13771 SetImmuneToPC(false); // unit has engaged in combat, remove immunity so players can fight back
13772
13773 if (IsInCombat())
13774 return;
13775
13777
13778 if (Creature* creature = ToCreature())
13779 {
13780 // Set home position at place of engaging combat for escorted creatures
13781 if ((IsAIEnabled && creature->AI()->IsEscorted()) ||
13782 GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE ||
13783 GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
13784 creature->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
13785
13786 if (enemy)
13787 {
13788 creature->UpdateLeashExtensionTime();
13789
13790 if (IsAIEnabled)
13791 creature->AI()->JustEngagedWith(enemy);
13792
13793 if (creature->GetFormation())
13794 creature->GetFormation()->MemberEngagingTarget(creature, enemy);
13795
13796 sScriptMgr->OnUnitEnterCombat(creature, enemy);
13797 }
13798
13799 creature->RefreshSwimmingFlag();
13800
13801 if (IsPet())
13802 {
13803 UpdateSpeed(MOVE_RUN, true);
13804 UpdateSpeed(MOVE_SWIM, true);
13805 UpdateSpeed(MOVE_FLIGHT, true);
13806 }
13807
13808 if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT))
13809 Dismount();
13810 if (!IsStandState()) // pussywizard: already done in CombatStart(target, initialAggro) for the target, but when aggro'ing from MoveInLOS CombatStart is not called!
13812 }
13813
13814 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
13815 {
13816 Unit* controlled = *itr;
13817 ++itr;
13818
13819 // Xinef: Dont set combat for passive units, they will evade in next update...
13820 if (controlled->IsCreature() && controlled->ToCreature()->HasReactState(REACT_PASSIVE))
13821 continue;
13822
13823 controlled->SetInCombatState(PvP, enemy, duration);
13824 }
13825
13826 if (Player* player = this->ToPlayer())
13827 {
13828 sScriptMgr->OnPlayerEnterCombat(player, enemy);
13829 }
13830}
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ WAYPOINT_MOTION_TYPE
Definition MotionMaster.h:41
@ CREATURE_TYPE_NON_COMBAT_PET
Definition SharedDefines.h:2639
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
Definition SharedDefines.h:2706
@ MOVE_FLIGHT
Definition UnitDefines.h:355
@ MOVE_SWIM
Definition UnitDefines.h:352
bool HasReactState(ReactStates state) const
Definition Creature.h:96
uint32 GetCombatTimer() const
Definition Unit.h:900
void SetInCombatState(bool PvP, Unit *enemy=nullptr, uint32 duration=0)
Definition Unit.cpp:13755
bool IsStandState() const
Definition Unit.cpp:16743

References CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT, CREATURE_TYPE_NON_COMBAT_PET, Dismount(), ESCORT_MOTION_TYPE, GetCharmerOrOwnerPlayerOrPlayerItself(), GetCombatTimer(), GetCreatureType(), GetMotionMaster(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Creature::HasReactState(), HasUnitState(), IsAIEnabled, IsAlive(), Object::IsCreature(), IsImmuneToPC(), IsInCombat(), IsPet(), IsStandState(), m_CombatTimer, m_Controlled, MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, REACT_PASSIVE, SetImmuneToPC(), SetInCombatState(), SetStandState(), SetUnitFlag(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_FLAG_IN_COMBAT, UNIT_STAND_STATE_STAND, UNIT_STATE_EVADE, UpdateSpeed(), and WAYPOINT_MOTION_TYPE.

Referenced by Spell::DoSpellHitOnUnit(), SetInCombatState(), and SetInCombatWith().

◆ SetInCombatWith()

void Unit::SetInCombatWith ( Unit enemy,
uint32  duration = 0 
)
13605{
13606 // Xinef: Dont allow to start combat with triggers
13607 if (enemy->IsCreature() && enemy->ToCreature()->IsTrigger())
13608 return;
13609
13610 Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf();
13611 if (eOwner->IsPvP() || eOwner->IsFFAPvP())
13612 {
13613 SetInCombatState(true, enemy, duration);
13614 return;
13615 }
13616
13617 // check for duel
13618 if (eOwner->IsPlayer() && eOwner->ToPlayer()->duel)
13619 {
13620 Unit const* myOwner = GetCharmerOrOwnerOrSelf();
13621 if (((Player const*)eOwner)->duel->Opponent == myOwner)
13622 {
13623 SetInCombatState(true, enemy, duration);
13624 return;
13625 }
13626 }
13627
13628 if (Creature* pCreature = ToCreature())
13629 pCreature->UpdateLeashExtensionTime();
13630
13631 SetInCombatState(false, enemy, duration);
13632}

References Player::duel, GetCharmerOrOwnerOrSelf(), Object::IsCreature(), IsFFAPvP(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), SetInCombatState(), Object::ToCreature(), and Object::ToPlayer().

Referenced by Attack(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), CombatStart(), CombatStartOnCast(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), Spell::DoAllEffectOnTarget(), CreatureAI::DoZoneInCombat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), spell_herald_volzaj_insanity::HandleDummyEffect(), boss_chromaggus::boss_chromaggusAI::PathEndReached(), SmartScript::ProcessAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), and npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI().

◆ SetInFront()

◆ SetInstantCast()

void Unit::SetInstantCast ( bool  set)
inline
1508{ _instantCast = set; }

References _instantCast.

Referenced by AuraEffect::HandleModCastingSpeed().

◆ SetLastDamagedTargetGuid()

void Unit::SetLastDamagedTargetGuid ( ObjectGuid const &  guid)
inline

◆ SetLastExtraAttackSpell()

void Unit::SetLastExtraAttackSpell ( uint32  spellId)
inline
959{ _lastExtraAttackSpell = spellId; }

References _lastExtraAttackSpell.

Referenced by Spell::_handle_finish_phase().

◆ SetLastManaUse()

void Unit::SetLastManaUse ( uint32  spellCastTime)
inline
1079{ m_lastManaUse = spellCastTime; }

References m_lastManaUse.

Referenced by Spell::TakePower().

◆ SetLevel()

◆ SetMaxHealth()

void Unit::SetMaxHealth ( uint32  val)
15552{
15553 if (!val)
15554 val = 1;
15555
15556 uint32 health = GetHealth();
15558
15559 // group update
15560 if (IsPlayer())
15561 {
15562 Player* player = ToPlayer();
15563 if (player->NeedSendSpectatorData())
15565
15566 if (player->GetGroup())
15568 }
15569 else if (Pet* pet = ToCreature()->ToPet())
15570 {
15571 if (pet->isControlled())
15572 {
15573 if (Unit* owner = GetOwner())
15574 if (Player* player = owner->ToPlayer())
15575 {
15576 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
15577 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
15578
15579 if (player->GetGroup())
15581 }
15582 }
15583 }
15584
15585 if (val < health)
15586 SetHealth(val);
15587}
@ GROUP_UPDATE_FLAG_MAX_HP
Definition Group.h:102
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition Group.h:114

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetHealth(), GetOwner(), GROUP_UPDATE_FLAG_MAX_HP, GROUP_UPDATE_FLAG_PET_MAX_HP, Object::IsPlayer(), Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetHealth(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXHEALTH.

Referenced by boss_xt002::boss_xt002AI::DoAction(), Spell::EffectSummonType(), modify_commandscript::HandleModifyHPCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_pet_pri_lightwell::InitializeAI(), Player::InitStatsForLevel(), boss_skeram::JustSummoned(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), Creature::SelectLevel(), npc_pet_hunter_snake_trap::UpdateAI(), Creature::UpdateMaxHealth(), Guardian::UpdateMaxHealth(), and Player::UpdateMaxHealth().

◆ SetMaxPower()

void Unit::SetMaxPower ( Powers  power,
uint32  val 
)
15655{
15656 uint32 cur_power = GetPower(power);
15657 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power, val);
15658
15659 // group update
15660 if (IsPlayer())
15661 {
15662 Player* player = ToPlayer();
15663 if (getPowerType() == power && player->NeedSendSpectatorData())
15664 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
15665
15666 if (player->GetGroup())
15668 }
15669 else if (Pet* pet = ToCreature()->ToPet())
15670 {
15671 if (pet->isControlled())
15672 {
15673 Unit* owner = GetOwner();
15674 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
15676 }
15677 }
15678
15679 if (val < cur_power)
15680 SetPower(power, val);
15681}
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition Group.h:117
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition Group.h:105
void SetStatInt32Value(uint16 index, int32 value)
Definition Object.cpp:798

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetOwner(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_MAX_POWER, GROUP_UPDATE_FLAG_PET_MAX_POWER, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetPower(), Object::SetStatInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::Create(), Pet::CreateBaseAtTamed(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), Creature::SelectLevel(), setPowerType(), Creature::UpdateMaxPower(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ SetMinion()

void Unit::SetMinion ( Minion minion,
bool  apply 
)
10709{
10710 LOG_DEBUG("entities.unit", "SetMinion {} for {}, apply {}", minion->GetEntry(), GetEntry(), apply);
10711
10712 if (apply)
10713 {
10714 if (minion->GetOwnerGUID())
10715 {
10716 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
10717 return;
10718 }
10719
10720 minion->SetOwnerGUID(GetGUID());
10721
10722 m_Controlled.insert(minion);
10723
10724 if (IsPlayer())
10725 {
10726 minion->m_ControlledByPlayer = true;
10728 }
10729
10730 // Can only have one pet. If a new one is summoned, dismiss the old one.
10731 if (minion->IsGuardianPet())
10732 {
10733 if (Guardian* oldPet = GetGuardianPet())
10734 {
10735 if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
10736 {
10737 // remove existing minion pet
10738 if (Pet* oldPetAsPet = oldPet->ToPet())
10739 {
10740 oldPetAsPet->Remove(PET_SAVE_NOT_IN_SLOT);
10741 }
10742 else
10743 {
10744 oldPet->UnSummon();
10745 }
10746
10747 SetPetGUID(minion->GetGUID());
10749 }
10750 }
10751 else
10752 {
10753 SetPetGUID(minion->GetGUID());
10755 }
10756 }
10757
10759 {
10761 }
10762
10763 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
10764 {
10765 SetCritterGUID(minion->GetGUID());
10766 }
10767
10768 // PvP, FFAPvP
10770
10771 // Ghoul pets have energy instead of mana (is anywhere better place for this code?)
10772 if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
10773 minion->setPowerType(POWER_ENERGY);
10774
10775 if (IsPlayer())
10776 {
10777 // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
10778 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
10779
10780 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
10781 ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, nullptr, true);
10782 }
10783 }
10784 else
10785 {
10786 if (minion->GetOwnerGUID() != GetGUID())
10787 {
10788 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
10789 return;
10790 }
10791
10792 m_Controlled.erase(minion);
10793
10794 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
10795 {
10796 if (GetCritterGUID() == minion->GetGUID())
10798 }
10799
10800 if (minion->IsGuardianPet())
10801 {
10802 if (GetPetGUID() == minion->GetGUID())
10804 }
10805 else if (minion->IsTotem())
10806 {
10807 // All summoned by totem minions must disappear when it is removed.
10808 if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
10809 {
10810 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
10811 {
10812 if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
10813 continue;
10814
10815 RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
10816 }
10817 }
10818 }
10819
10820 if (IsPlayer())
10821 {
10822 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
10823 // Remove infinity cooldown
10824 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
10825 ToPlayer()->SendCooldownEvent(spellInfo);
10826
10827 // xinef: clear spell book
10828 if (m_Controlled.empty())
10830 }
10831
10832 //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
10833 {
10835 {
10836 // Check if there is another minion
10837 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10838 {
10839 // do not use this check, creature do not have charm guid
10840 //if (GetCharmGUID() == (*itr)->GetGUID())
10841 if (GetGUID() == (*itr)->GetCharmerGUID())
10842 continue;
10843
10844 //ASSERT((*itr)->GetOwnerGUID() == GetGUID());
10845 if ((*itr)->GetOwnerGUID() != GetGUID())
10846 {
10847 OutDebugInfo();
10848 (*itr)->OutDebugInfo();
10849 ABORT();
10850 }
10851 ASSERT((*itr)->IsCreature());
10852
10853 if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
10854 continue;
10855
10856 if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
10857 {
10858 // show another pet bar if there is no charm bar
10859 if (IsPlayer() && !GetCharmGUID())
10860 {
10861 if ((*itr)->IsPet())
10863 else
10865 }
10866 }
10867 break;
10868 }
10869 }
10870 }
10871 }
10872}
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:45
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:806
@ SUMMON_TYPE_MINIPET
Definition SharedDefines.h:3299
bool IsGuardianPet() const
Definition TemporarySummon.cpp:395
bool IsPetGhoul() const
Definition TemporarySummon.h:85
void PetSpellInitialize()
Definition Player.cpp:9500
const SummonPropertiesEntry *const m_Properties
Definition TemporarySummon.h:64
uint32 GetSpell(uint8 slot=0) const
Definition Totem.h:59
void OutDebugInfo() const
Definition Unit.cpp:20257
ObjectGuid GetCritterGUID() const
Definition Unit.h:696
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:10596
void SetCritterGUID(ObjectGuid guid)
Definition Unit.h:695
void setPowerType(Powers power)
Definition Unit.cpp:10002
void RemoveAllMinionsByEntry(uint32 entry)
Definition Unit.cpp:10886
uint32 Type
Definition DBCStructure.h:1912

References ABORT, Object::AddGuidValue(), Player::AddSpellAndCategoryCooldowns(), ASSERT, Player::CharmSpellInitialize(), ObjectGuid::Empty, Object::GetByteValue(), GetCharmGUID(), GetCritterGUID(), Object::GetEntry(), GetGuardianPet(), Object::GetGUID(), Object::GetGUID(), GetOwnerGUID(), GetPetGUID(), Totem::GetSpell(), Object::GetUInt32Value(), HasUnitTypeMask(), SpellInfo::IsCooldownStartedOnEvent(), Minion::IsGuardianPet(), IsPet(), Minion::IsPetGhoul(), Object::IsPlayer(), IsTotem(), LOG_DEBUG, LOG_FATAL, m_Controlled, m_ControlledByPlayer, TempSummon::m_Properties, MAX_SPELL_EFFECTS, OutDebugInfo(), PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), POWER_ENERGY, RemoveAllMinionsByEntry(), Object::RemoveGuidValue(), Player::SendCooldownEvent(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCritterGUID(), SetMinionGUID(), SetOwnerGUID(), SetPetGUID(), setPowerType(), SetUnitFlag(), SPELL_EFFECT_SUMMON, sSpellMgr, SUMMON_TYPE_MINIPET, ToPet(), Object::ToPlayer(), ToTotem(), SummonPropertiesEntry::Type, UNIT_CREATED_BY_SPELL, UNIT_FIELD_BYTES_2, UNIT_FIELD_SUMMON, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_CONTROLABLE_GUARDIAN.

Referenced by Player::CreatePet(), Player::CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectTameCreature(), Pet::LoadPetFromDB(), Player::RemovePet(), and Player::SummonPet().

◆ SetMinionGUID()

void Unit::SetMinionGUID ( ObjectGuid  guid)
inline

◆ SetModelVisible()

◆ SetModifierValue()

◆ SetNativeDisplayId()

◆ SetNpcFlag()

void Unit::SetNpcFlag ( NPCFlags  flags)
inline

References flags, Object::SetFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::InitializeAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::JustReachedHome(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_chesspiece::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_pos_leader_second::npc_pos_leader_secondAI::MovementInform(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::MovementInform(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::MovementInform(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_akama_illidan::PathEndReached(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), Vehicle::RemovePassenger(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_hyjal_jaina::hyjalJainaAI::Reset(), npc_hyjal_thrall::hyjalThrallAI::Reset(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_akama_illidan::Reset(), npc_akama_shade::Reset(), npc_magister_aledis::Reset(), Vehicle::Reset(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::ResetData(), NPCStaveQuestAI::ResetState(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), Vehicle::Vehicle(), npc_arthas::npc_arthasAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ SetOwnerGUID()

void Unit::SetOwnerGUID ( ObjectGuid  owner)
10597{
10598 if (GetOwnerGUID() == owner)
10599 return;
10600
10602 if (!owner)
10603 return;
10604
10605 m_applyResilience = !IsVehicle() && owner.IsPlayer();
10606
10607 // Update owner dependent fields
10608 Player* player = ObjectAccessor::GetPlayer(*this, owner);
10609 if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
10610 return;
10611
10613
10614 UpdateData udata;
10615 WorldPacket packet;
10616 BuildValuesUpdateBlockForPlayer(&udata, player);
10617 udata.BuildPacket(packet);
10618 player->SendDirectMessage(&packet);
10619
10621}
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition Object.cpp:257
void RemoveFieldNotifyFlag(uint16 flag)
Definition Object.h:195
void SetFieldNotifyFlag(uint16 flag)
Definition Object.h:194
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:11444
Definition UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition UpdateData.cpp:48

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Player::HaveAtClient(), ObjectGuid::IsPlayer(), IsVehicle(), m_applyResilience, Object::RemoveFieldNotifyFlag(), Player::SendDirectMessage(), Object::SetFieldNotifyFlag(), Object::SetGuidValue(), UF_FLAG_OWNER, and UNIT_FIELD_SUMMONEDBY.

Referenced by GameObject::CastSpell(), Spell::EffectSummonType(), boss_illidari_council_memberAI::EnterEvadeMode(), spell_item_draenic_pale_ale::HandleSummon(), npc_pet_gen_fetch_ball::IsSummonedBy(), boss_razorgore::boss_razorgoreAI::JustSummoned(), Player::LoadFromDB(), SetMinion(), and npc_grimstone::npc_grimstoneAI::UpdateEscortAI().

◆ SetPetGUID()

◆ SetPhaseMask()

void Unit::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
overridevirtual

Reimplemented from WorldObject.

19073{
19074 if (newPhaseMask == GetPhaseMask())
19075 return;
19076
19077 if (IsInWorld())
19078 {
19079 // xinef: to comment, bellow line should be removed
19080 // pussywizard: goign to other phase (valithria, algalon) should not remove such auras
19081 //RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
19082
19083 if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
19084 return;
19085
19086 // modify hostile references for new phasemask, some special cases deal with hostile references themselves
19087 if (IsCreature() || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
19088 {
19089 HostileRefMgr& refMgr = getHostileRefMgr();
19090 HostileReference* ref = refMgr.getFirst();
19091
19092 while (ref)
19093 {
19094 if (Unit* unit = ref->GetSource()->GetOwner())
19095 if (Creature* creature = unit->ToCreature())
19096 refMgr.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask));
19097
19098 ref = ref->next();
19099 }
19100
19101 // modify threat lists for new phasemask
19102 if (!IsPlayer())
19103 {
19106
19107 // merge expects sorted lists
19108 threatList.sort();
19109 offlineThreatList.sort();
19110 threatList.merge(offlineThreatList);
19111
19112 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
19113 if (Unit* unit = (*itr)->getTarget())
19114 unit->getHostileRefMgr().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask));
19115 }
19116 }
19117 }
19118
19119 WorldObject::SetPhaseMask(newPhaseMask, false);
19120
19121 if (!IsInWorld())
19122 {
19123 return;
19124 }
19125
19126 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); )
19127 {
19128 Unit* controlled = *itr;
19129 ++itr;
19130 if (controlled->IsCreature())
19131 {
19132 controlled->SetPhaseMask(newPhaseMask, true);
19133 }
19134 }
19135
19136 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
19137 {
19138 if (m_SummonSlot[i])
19139 {
19140 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
19141 {
19142 summon->SetPhaseMask(newPhaseMask, true);
19143 }
19144 }
19145 }
19146
19147 if (update)
19148 {
19150 }
19151}
Definition HostileRefMgr.h:31
void setOnlineOfflineState(bool isOnline)
Definition HostileRefMgr.cpp:98
HostileReference * getFirst()
Definition HostileRefMgr.h:59
HostileReference * next()
Definition ThreatMgr.h:115
FROM * GetSource() const
Definition Reference.h:97
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition ThreatMgr.h:274
Unit * GetOwner() const
Definition ThreatMgr.h:236
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:19072
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition Object.cpp:2888
uint32 GetPhaseMask() const
Definition Object.h:451

References Map::GetCreature(), HostileRefMgr::getFirst(), getHostileRefMgr(), WorldObject::GetMap(), ThreatMgr::GetOfflineThreatList(), ThreatMgr::GetOwner(), WorldObject::GetPhaseMask(), Reference< TO, FROM >::GetSource(), ThreatMgr::GetThreatList(), GetThreatMgr(), WorldObject::InSamePhase(), Object::IsCreature(), Object::IsInWorld(), Object::IsPlayer(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, HostileReference::next(), HostileRefMgr::setOnlineOfflineState(), WorldObject::SetPhaseMask(), SetPhaseMask(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), and UpdateObjectVisibility().

Referenced by Pet::Create(), Creature::Create(), misc_commandscript::HandleAppearCommand(), modify_commandscript::HandleModifyPhaseCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), spell_wintergrasp_hide_small_elementals_aura::HandlePeriodicDummy(), AuraEffect::HandlePhase(), Battlefield::HideNpc(), boss_volazj::InitializeAI(), boss_zuramat::boss_zuramatAI::JustSummoned(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), BattlegroundAB::RemovePlayer(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), Creature::setDeathState(), Player::SetGameMaster(), SetPhaseMask(), Battlefield::ShowNpc(), WorldObject::SummonTrigger(), and npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached().

◆ SetPower()

void Unit::SetPower ( Powers  power,
uint32  val,
bool  withPowerUpdate = true,
bool  fromRegenerate = false 
)
15590{
15591 if (!fromRegenerate && GetPower(power) == val)
15592 {
15593 return;
15594 }
15595
15596 uint32 maxPower = GetMaxPower(power);
15597 if (maxPower < val)
15598 {
15599 val = maxPower;
15600 }
15601
15602 if (fromRegenerate)
15603 {
15604 UpdateUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, val);
15606 }
15607 else
15608 {
15609 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, val);
15610 }
15611
15612 if (withPowerUpdate)
15613 {
15615 data << GetPackGUID();
15616 data << uint8(power);
15617 data << uint32(val);
15618 SendMessageToSet(&data, IsPlayer());
15619 }
15620
15621 // group update
15622 if (IsPlayer())
15623 {
15624 Player* player = ToPlayer();
15625 if (getPowerType() == power && player->NeedSendSpectatorData())
15626 {
15627 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
15628 }
15629
15630 if (player->GetGroup())
15631 {
15633 }
15634 }
15635 else if (Pet* pet = ToCreature()->ToPet())
15636 {
15637 if (pet->isControlled())
15638 {
15639 Unit* owner = GetOwner();
15640 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
15641 {
15643 }
15644 }
15645
15646 // Update the pet's character sheet with happiness damage bonus
15647 if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
15648 {
15649 pet->UpdateDamagePhysical(BASE_ATTACK);
15650 }
15651 }
15652}
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition Group.h:116
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition Group.h:104
void UpdateUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:663
void AddToObjectUpdateIfNeeded()
Definition Object.cpp:524
@ SMSG_POWER_UPDATE
Definition Opcodes.h:1182

References Object::AddToObjectUpdateIfNeeded(), BASE_ATTACK, WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), Object::GetPackGUID(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_CUR_POWER, GROUP_UPDATE_FLAG_PET_CUR_POWER, HUNTER_PET, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_HAPPINESS, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), WorldObject::SendMessageToSet(), Player::SetGroupUpdateFlag(), Object::SetStatInt32Value(), SMSG_POWER_UPDATE, Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_POWER1, and Object::UpdateUInt32Value().

Referenced by Player::ActivateSpec(), Player::Create(), Pet::CreateBaseAtTamed(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), WorldSession::HandlePetAbandon(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), boss_shade_of_aran::OnPowerUpdate(), Player::ProcessDelayedOperations(), Player::Regenerate(), spell_igb_incinerating_blast::RemoveEnergy(), spell_igb_below_zero::RemovePassengers(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_selin_fireheart::Reset(), boss_moam::Reset(), npc_obsidian_destroyer::Reset(), npc_obsidian_eradicator::Reset(), npc_obsidian_nullifier::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::RestoreManaAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetMaxPower(), setPowerType(), Player::SummonPet(), and npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI().

◆ setPowerType()

void Unit::setPowerType ( Powers  power)
10003{
10004 SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
10005
10006 if (IsPlayer())
10007 {
10008 if (ToPlayer()->GetGroup())
10010 }
10011 else if (Pet* pet = ToCreature()->ToPet())
10012 {
10013 if (pet->isControlled())
10014 {
10015 Unit* owner = GetOwner();
10016 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
10018 }
10019 }
10020
10021 float powerMultiplier = 1.0f;
10022 if (!IsPet())
10023 if (Creature* creature = ToCreature())
10024 powerMultiplier = creature->GetCreatureTemplate()->ModMana;
10025
10026 switch (new_powertype)
10027 {
10028 default:
10029 case POWER_MANA:
10030 break;
10031 case POWER_RAGE:
10032 SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
10033 SetPower(POWER_RAGE, 0);
10034 break;
10035 case POWER_FOCUS:
10036 SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
10037 SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
10038 break;
10039 case POWER_ENERGY:
10040 SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
10041 break;
10042 case POWER_HAPPINESS:
10043 SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
10044 SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
10045 break;
10046 }
10047
10048 if (Player const* player = ToPlayer())
10049 if (player->NeedSendSpectatorData())
10050 {
10051 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype);
10052 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype) / 10 : GetMaxPower(new_powertype));
10053 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype) / 10 : GetPower(new_powertype));
10054 }
10055}
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition Group.h:103
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition Group.h:115
void SetMaxPower(Powers power, uint32 val)
Definition Unit.cpp:15654

References WorldObject::FindMap(), GetCreatePowers(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), GetPower(), GROUP_UPDATE_FLAG_PET_POWER_TYPE, GROUP_UPDATE_FLAG_POWER_TYPE, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Object::SetByteValue(), Player::SetGroupUpdateFlag(), SetMaxPower(), SetPower(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_BYTES_0.

Referenced by Pet::CreateBaseAtTamed(), AuraEffect::HandleAuraModShapeshift(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitDataForForm(), Vehicle::Install(), Pet::LoadPetFromDB(), npc_toc_rogue::npc_toc_rogueAI::npc_toc_rogueAI(), SetMinion(), and Player::SummonPet().

◆ SetPvP()

◆ setRace()

void Unit::setRace ( uint8  race)
21043{
21044 if (IsPlayer())
21045 m_race = race;
21046}

References Object::IsPlayer(), and m_race.

◆ SetRedirectThreat()

void Unit::SetRedirectThreat ( ObjectGuid  guid,
uint32  pct 
)
inline
916{ _redirectThreatInfo.Set(guid, pct); }
void Set(ObjectGuid guid, uint32 pct)
Definition ThreatMgr.h:301

References _redirectThreatInfo, and RedirectThreatInfo::Set().

Referenced by Spell::EffectRedirectThreat(), and ResetRedirectThreat().

◆ SetResistance()

◆ SetResistanceBuffMods()

void Unit::SetResistanceBuffMods ( SpellSchools  school,
bool  positive,
float  val 
)
inline

◆ SetRooted()

void Unit::SetRooted ( bool  apply,
bool  isStun = false 
)
protected
18228{
18229 if (apply)
18230 {
18231 if (m_rootTimes > 0) // blizzard internal check?
18232 m_rootTimes++;
18233
18234 // MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a)
18235 // this will freeze clients. That's why we remove MOVEMENTFLAG_MASK_MOVING before
18236 // setting MOVEMENTFLAG_ROOT
18238
18239 if (IsFalling())
18240 {
18242 }
18243 else
18244 {
18246 }
18247
18248 // Creature specific
18249 if (!IsPlayer())
18250 {
18251 if (isStun && movespline->Finalized())
18252 {
18254 }
18255 else
18256 {
18257 StopMoving();
18258 }
18259 }
18260
18261 if (m_movedByPlayer)
18262 {
18263 WorldPacket data(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4);
18264 data << GetPackGUID();
18265 data << m_rootTimes;
18267 }
18268 else
18269 {
18271 data << GetPackGUID();
18272 SendMessageToSet(&data, true);
18273 }
18274 }
18275 else
18276 {
18278
18279 if (!HasUnitState(UNIT_STATE_STUNNED)) // prevent moving if it also has stun effect
18280 {
18281 if (m_movedByPlayer)
18282 {
18284 data << GetPackGUID();
18285 data << m_rootTimes;
18287 }
18288 else
18289 {
18291 data << GetPackGUID();
18292 SendMessageToSet(&data, true);
18293 }
18294 }
18295 }
18296}
@ MOVEMENTFLAG_PENDING_ROOT
Definition UnitDefines.h:385
void StopMovingOnCurrentPos()
Definition Unit.cpp:16712
@ SMSG_FORCE_MOVE_UNROOT
Definition Opcodes.h:264
@ SMSG_FORCE_MOVE_ROOT
Definition Opcodes.h:262
@ SMSG_SPLINE_MOVE_ROOT
Definition Opcodes.h:824

References AddUnitMovementFlag(), Movement::MoveSpline::Finalized(), Object::GetPackGUID(), HasUnitState(), IsFalling(), Object::IsPlayer(), m_movedByPlayer, m_rootTimes, MOVEMENTFLAG_MASK_MOVING, MOVEMENTFLAG_PENDING_ROOT, MOVEMENTFLAG_ROOT, movespline, RemoveUnitMovementFlag(), Player::SendDirectMessage(), WorldObject::SendMessageToSet(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_SPLINE_MOVE_ROOT, SMSG_SPLINE_MOVE_UNROOT, StopMoving(), StopMovingOnCurrentPos(), Object::ToPlayer(), and UNIT_STATE_STUNNED.

Referenced by WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), SetControlled(), and SetStunned().

◆ SetShapeshiftForm()

void Unit::SetShapeshiftForm ( ShapeshiftForm  form)
inline

◆ SetSheath()

◆ SetSpeed()

void Unit::SetSpeed ( UnitMoveType  mtype,
float  rate,
bool  forced = false 
)
14453{
14454 if (rate < 0)
14455 rate = 0.0f;
14456
14457 // Update speed only on change
14458 if (m_speed_rate[mtype] == rate)
14459 return;
14460
14461 m_speed_rate[mtype] = rate;
14462
14464
14465 WorldPacket data;
14466 if (!forced)
14467 {
14468 switch (mtype)
14469 {
14470 case MOVE_WALK:
14471 data.Initialize(MSG_MOVE_SET_WALK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14472 break;
14473 case MOVE_RUN:
14474 data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14475 break;
14476 case MOVE_RUN_BACK:
14477 data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14478 break;
14479 case MOVE_SWIM:
14480 data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14481 break;
14482 case MOVE_SWIM_BACK:
14483 data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14484 break;
14485 case MOVE_TURN_RATE:
14486 data.Initialize(MSG_MOVE_SET_TURN_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14487 break;
14488 case MOVE_FLIGHT:
14489 data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14490 break;
14491 case MOVE_FLIGHT_BACK:
14492 data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14493 break;
14494 case MOVE_PITCH_RATE:
14495 data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14496 break;
14497 default:
14498 LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype);
14499 return;
14500 }
14501
14502 data << GetPackGUID();
14503 BuildMovementPacket(&data);
14504 data << float(GetSpeed(mtype));
14505 SendMessageToSet(&data, true);
14506 }
14507 else
14508 {
14509 if (IsPlayer())
14510 {
14511 // register forced speed changes for WorldSession::HandleForceSpeedChangeAck
14512 // and do it only for real sent packets and use run for run/mounted as client expected
14513 ++ToPlayer()->m_forced_speed_changes[mtype];
14514
14515 // Xinef: update speed of pet also
14516 if (!IsInCombat())
14517 {
14518 Unit* pet = ToPlayer()->GetPet();
14519 if (!pet)
14520 pet = GetCharm();
14521
14522 // xinef: do not affect vehicles and possesed pets
14523 if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
14524 pet = nullptr;
14525
14526 if (pet && pet->IsCreature() && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
14527 pet->UpdateSpeed(mtype, forced);
14528 if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID()))
14529 critter->UpdateSpeed(mtype, forced);
14530 }
14531 ToPlayer()->SetCanTeleport(true);
14532 }
14533
14534 switch (mtype)
14535 {
14536 case MOVE_WALK:
14538 break;
14539 case MOVE_RUN:
14541 break;
14542 case MOVE_RUN_BACK:
14544 break;
14545 case MOVE_SWIM:
14547 break;
14548 case MOVE_SWIM_BACK:
14550 break;
14551 case MOVE_TURN_RATE:
14553 break;
14554 case MOVE_FLIGHT:
14556 break;
14557 case MOVE_FLIGHT_BACK:
14559 break;
14560 case MOVE_PITCH_RATE:
14562 break;
14563 default:
14564 LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype);
14565 return;
14566 }
14567 data << GetPackGUID();
14568 data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39
14569 if (mtype == MOVE_RUN)
14570 data << uint8(0); // new 2.1.0
14571 data << float(GetSpeed(mtype));
14572 SendMessageToSet(&data, true);
14573 }
14574}
@ FOLLOW_MOTION_TYPE
Definition MotionMaster.h:54
@ MOVE_TURN_RATE
Definition UnitDefines.h:354
@ MOVE_FLIGHT_BACK
Definition UnitDefines.h:356
@ MOVE_SWIM_BACK
Definition UnitDefines.h:353
@ MOVE_PITCH_RATE
Definition UnitDefines.h:357
@ MOVE_RUN_BACK
Definition UnitDefines.h:351
@ MOVE_WALK
Definition UnitDefines.h:349
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:913
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition Player.h:2403
float GetSpeed(UnitMoveType mtype) const
Definition Unit.cpp:14447
void propagateSpeedChange()
Definition Unit.h:1655
@ SMSG_FORCE_TURN_RATE_CHANGE
Definition Opcodes.h:764
@ MSG_MOVE_SET_SWIM_BACK_SPEED
Definition Opcodes.h:243
@ MSG_MOVE_SET_TURN_RATE
Definition Opcodes.h:246
@ SMSG_FORCE_WALK_SPEED_CHANGE
Definition Opcodes.h:760
@ SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE
Definition Opcodes.h:929
@ MSG_MOVE_SET_PITCH_RATE
Definition Opcodes.h:1145
@ SMSG_FORCE_RUN_SPEED_CHANGE
Definition Opcodes.h:256
@ SMSG_FORCE_SWIM_BACK_SPEED_CHANGE
Definition Opcodes.h:762
@ SMSG_FORCE_RUN_BACK_SPEED_CHANGE
Definition Opcodes.h:258
@ SMSG_FORCE_FLIGHT_SPEED_CHANGE
Definition Opcodes.h:927
@ SMSG_FORCE_SWIM_SPEED_CHANGE
Definition Opcodes.h:260
@ MSG_MOVE_SET_RUN_SPEED
Definition Opcodes.h:235
@ MSG_MOVE_SET_FLIGHT_SPEED
Definition Opcodes.h:924
@ MSG_MOVE_SET_WALK_SPEED
Definition Opcodes.h:239
@ MSG_MOVE_SET_SWIM_SPEED
Definition Opcodes.h:241
@ MSG_MOVE_SET_FLIGHT_BACK_SPEED
Definition Opcodes.h:926
@ SMSG_FORCE_PITCH_RATE_CHANGE
Definition Opcodes.h:1146
@ MSG_MOVE_SET_RUN_BACK_SPEED
Definition Opcodes.h:237

References BuildMovementPacket(), FOLLOW_MOTION_TYPE, GetCharm(), GetCritterGUID(), MotionMaster::GetCurrentMovementGeneratorType(), GetMotionMaster(), Object::GetPackGUID(), Player::GetPet(), GetSpeed(), ObjectAccessor::GetUnit(), HasUnitFlag(), WorldPacket::Initialize(), Object::IsCreature(), IsInCombat(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, Player::m_forced_speed_changes, m_speed_rate, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_PITCH_RATE, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_TURN_RATE, MOVE_WALK, MSG_MOVE_SET_FLIGHT_BACK_SPEED, MSG_MOVE_SET_FLIGHT_SPEED, MSG_MOVE_SET_PITCH_RATE, MSG_MOVE_SET_RUN_BACK_SPEED, MSG_MOVE_SET_RUN_SPEED, MSG_MOVE_SET_SWIM_BACK_SPEED, MSG_MOVE_SET_SWIM_SPEED, MSG_MOVE_SET_TURN_RATE, MSG_MOVE_SET_WALK_SPEED, propagateSpeedChange(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, SMSG_FORCE_FLIGHT_SPEED_CHANGE, SMSG_FORCE_PITCH_RATE_CHANGE, SMSG_FORCE_RUN_BACK_SPEED_CHANGE, SMSG_FORCE_RUN_SPEED_CHANGE, SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, SMSG_FORCE_SWIM_SPEED_CHANGE, SMSG_FORCE_TURN_RATE_CHANGE, SMSG_FORCE_WALK_SPEED_CHANGE, Object::ToPlayer(), UNIT_FLAG_POSSESSED, and UpdateSpeed().

Referenced by Battleground::AddCreature(), boss_bug_trio::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_volkhan::boss_volkhanAI::GoToAnvil(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), WorldSession::HandleForceSpeedChangeAck(), modify_commandscript::HandleModifyASpeedCommand(), modify_commandscript::HandleModifyMountCommand(), Creature::InitEntry(), boss_glob_of_viscidus::InitializeAI(), Guardian::InitStatsForLevel(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_sartharion_dragonAI::JustEngagedWith(), boss_four_horsemen::boss_four_horsemenAI::JustEngagedWith(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), boss_onyxia::MovementInform(), boss_bug_trio::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_akilzon_eagle::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_batrider::npc_batrider(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), SmartScript::ProcessAction(), boss_nightbane::Reset(), boss_kalec::Reset(), npc_zuljin_vortex::Reset(), boss_headless_horseman::Reset(), boss_onyxia::Reset(), boss_bug_trio::Reset(), boss_sartharion_dragonAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::boss_volkhanAI::Reset(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), npc_freed_protodrake::npc_freed_protodrakeAI::Reset(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), npc_eastvale_peasent::SetData(), Battlefield::SpawnCreature(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_akilzon_eagle::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::UpdateAI(), UpdateSpeed(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetSpeedRate()

◆ SetStandFlags()

◆ SetStandState()

void Unit::SetStandState ( uint8  state)
16750{
16752
16753 if (IsStandState())
16755
16756 if (IsPlayer())
16757 {
16759 data << (uint8)state;
16760 ToPlayer()->GetSession()->SendPacket(&data);
16761 }
16762}
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition UnitDefines.h:23
@ SMSG_STANDSTATE_UPDATE
Definition Opcodes.h:699

References AURA_INTERRUPT_FLAG_NOT_SEATED, Player::GetSession(), Object::IsPlayer(), IsStandState(), RemoveAurasWithInterruptFlags(), WorldSession::SendPacket(), Object::SetByteValue(), SMSG_STANDSTATE_UPDATE, Object::ToPlayer(), UNIT_BYTES_1_OFFSET_STAND_STATE, and UNIT_FIELD_BYTES_1.

Referenced by _ApplyAura(), npc_mograine::npc_mograineAI::AshbringerEvent(), boss_felmyst::boss_felmyst(), boss_kologarn::boss_kologarnAI::boss_kologarnAI(), boss_twinemperorsAI::boss_twinemperorsAI(), boss_thekal::CheckPhaseTransition(), npc_ringo::npc_ringoAI::ClearFaint(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), CombatStart(), npc_vrykul_skeleton::DamageTaken(), boss_alar::DamageTaken(), boss_thekal::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_nightbane::DoAction(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_the_lurker_below::DoAction(), boss_leotheras_the_blind::DoAction(), npc_madrigosa::DoAction(), boss_illidan_stormrage::DoAction(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), Spell::DoAllEffectOnTarget(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_ahune::Emerge(), UtherBatteredHiltEvent::Execute(), SuckBackEvent::Execute(), boss_ahune::ExecuteEvent(), boss_ingvar_the_plunderer::FeignDeath(), WorldSession::HandleAlterAppearance(), WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStandStateChangeOpcode(), spell_q11322_q11317_the_cleansing::if(), DistractMovementGenerator::Initialize(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_kalecgos::JustEngagedWith(), boss_palehoof::boss_palehoofAI::JustReachedHome(), npc_massive_jormungar::npc_massive_jormungarAI::JustReachedHome(), npc_ferocious_rhino::npc_ferocious_rhinoAI::JustReachedHome(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::JustReachedHome(), npc_frenzied_worgen::npc_frenzied_worgenAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_kologarn::boss_kologarnAI::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_twilight_volunteer::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), npc_madrigosa::npc_madrigosa(), spell_love_is_in_the_air_romantic_picnic::OnApply(), boss_shade_of_aran::OnPowerUpdate(), npc_kernobee::OnQuestAccept(), npc_koltira_deathweaver::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_bonker_togglevolt::OnQuestAccept(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), Spell::prepare(), PretendToDie(), boss_alar::PretendToDie(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_kalecgos::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_thekal::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Reset(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::Reset(), boss_illidan_stormrage::Reset(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), Resurrect(), boss_the_lurker_below::SchedulerPhaseOne(), boss_the_lurker_below::SchedulerPhaseTwo(), npc_ringo::npc_ringoAI::SetFaint(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), SetInCombatState(), npc_kerlonian::npc_kerlonianAI::SetSleeping(), SetStunned(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_harrison_jones::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), advisor_baseAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_felmyst::StartIntro(), boss_ahune::Submerge(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_vrykul_skeleton::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_tallhorn_stag::npc_tallhorn_stagAI::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), GameObject::Use(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetStat()

void Unit::SetStat ( Stats  stat,
int32  val 
)
inline

◆ SetStunned()

void Unit::SetStunned ( bool  apply)
protected
18180{
18182 {
18183 return;
18184 }
18185
18186 if (apply)
18187 {
18188 SetTarget();
18190
18191 if (IsPlayer())
18192 {
18194 }
18195
18196 SetRooted(true, true);
18197
18198 CastStop();
18199 }
18200 else
18201 {
18202 if (IsAlive() && GetVictim())
18204
18205 if (IsCreature())
18206 {
18207 // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
18208 Unit* owner = GetOwner();
18209 if (!owner || !owner->IsPlayer() || !owner->ToPlayer()->IsMounted())
18211
18212 // Xinef: same for charmed npcs
18213 owner = GetCharmer();
18214 if (!owner || !owner->IsPlayer() || !owner->ToPlayer()->IsMounted())
18216 }
18217 else
18219
18220 if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect
18221 {
18222 SetRooted(false, true);
18223 }
18224 }
18225}

References CastStop(), GetCharmer(), Object::GetGUID(), GetOwner(), GetVictim(), HasUnitState(), IsAlive(), Object::IsCreature(), IsMounted(), Object::IsPlayer(), RemoveUnitFlag(), SetRooted(), SetStandState(), SetTarget(), SetUnitFlag(), Object::ToPlayer(), UNIT_FLAG_STUNNED, UNIT_STAND_STATE_STAND, UNIT_STATE_IN_FLIGHT, and UNIT_STATE_ROOT.

Referenced by SetControlled().

◆ SetSwim()

bool Unit::SetSwim ( bool  enable)
virtual

◆ SetTarget()

virtual void Unit::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
pure virtual

◆ setTransForm()

void Unit::setTransForm ( uint32  spellid)
inline
1880{ m_transform = spellid;}

References m_transform.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetUInt32Value()

void Unit::SetUInt32Value ( uint16  index,
uint32  value 
)
21340{
21341 Object::SetUInt32Value(index, value);
21342
21343 switch (index)
21344 {
21345 // Invalidating the cache on health change should fix an issue where the client sees dead NPCs when they are not.
21346 // We might also need to invalidate the cache for some other fields as well.
21347 case UNIT_FIELD_HEALTH:
21349 break;
21350 }
21351}
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:650
void InvalidateValuesUpdateCache()
Definition Unit.h:2138

References InvalidateValuesUpdateCache(), Object::SetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_LoadDailyQuestStatus(), Player::_LoadSkills(), Player::AddItemToBuyBackSlot(), Attack(), Player::CheckAreaExploreAndOutdoor(), Spell::CheckItems(), Player::Create(), Pet::CreateBaseAtTamed(), Player::CreatePet(), Player::CreatePet(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), Dismount(), npc_harrison_jones::DoAction(), boss_thekal::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_pathaleon_the_calculator::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_illidan_stormrage::DoAction(), Player::DuelComplete(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), boss_jindo::EnterEvadeMode(), boss_zuljin::EnterPhase(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraTransform(), character_commandscript::HandleCharacterLevel(), debug_commandscript::HandleDebugMod32ValueCommand(), debug_commandscript::HandleDebugUpdateCommand(), spell_dk_dancing_rune_weapon_visual::HandleEffectApply(), spell_gen_model_visible::HandleEffectApply(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_baby_murloc::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), misc_commandscript::HandleHideAreaCommand(), modify_commandscript::HandleModifyStandStateCommand(), modify_commandscript::HandleMorphMountCommand(), WorldSession::HandleMovementOpcodes(), AuraEffect::HandleNoReagentUseAura(), npc_commandscript::HandleNpcPlayEmoteCommand(), WorldSession::HandlePetRename(), reset_commandscript::HandleResetHonorCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), WorldSession::HandleSelfResOpcode(), WorldSession::HandleSetTitleOpcode(), WorldSession::HandleSetWatchedFactionOpcode(), misc_commandscript::HandleShowAreaCommand(), WorldSession::HandleTextEmoteOpcode(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), Player::InitGlyphsForLevel(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Initialize(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), InitTamedPet(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustDied(), boss_xt002::boss_xt002AI::JustEngagedWith(), npc_dragonflayer_forge_master::JustEngagedWith(), boss_jindo::JustEngagedWith(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_akama_illidan::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Kill(), Creature::LoadCreaturesAddon(), Creature::LoadEquipment(), Player::LoadFromDB(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), Player::ModifySkillBonus(), Mount(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_harrison_jones::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), npc_tirion_fordring_tft::npc_tirion_fordringAI::MovementInform(), npc_akama_illidan::MovementInform(), npc_thassarian2::npc_thassarian2AI::MovementInform(), npc_apothecary_genericAI::MovementInform(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::npc_pos_martin_or_gorkun_secondAI(), spell_gen_clone_weapon_aura::OnApply(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_ame::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), spell_gen_clone_weapon_aura::OnRemove(), npc_eastvale_peasent::PathEndReached(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), Player::RemoveAmmo(), Player::RemoveItemFromBuyBackSlot(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), ReplaceAllDynamicFlags(), ReplaceAllNpcFlags(), Player::ReplaceAllPlayerFlags(), ReplaceAllUnitFlags(), ReplaceAllUnitFlags2(), boss_ragnaros::boss_ragnarosAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_zuljin::Reset(), boss_arlokk::boss_arlokkAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), npc_hor_leader::npc_hor_leaderAI::Reset(), boss_malygos::boss_malygosAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_amberpine_woodsman::npc_amberpine_woodsmanAI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetDailyQuestStatus(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), Spell::SendChannelStart(), Spell::SendChannelUpdate(), Player::SetAmmo(), Player::SetArenaPoints(), Player::SetArenaTeamInfoField(), SetCharmedBy(), SetCreateHealth(), SetCreateMana(), Player::SetCurrentTitle(), Player::SetDailyQuestStatus(), npc_ulduar_vx001::npc_ulduar_vx001AI::SetData(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::SetData(), npc_eastvale_peasent::SetData(), setDeathState(), Player::setDeathState(), SetDisplayId(), SetFaction(), Player::SetFreePrimaryProfessions(), Player::SetFreeTalentPoints(), Player::SetGlyph(), Player::SetGlyphSlot(), SetHealth(), Player::SetHonorPoints(), Player::SetInGuild(), SetLevel(), SetMaxHealth(), Player::SetMoney(), SetNativeDisplayId(), CharmInfo::SetPetNumber(), Player::SetQuestSlot(), Player::SetQuestSlotTimer(), Player::SetRank(), Player::SetRestBonus(), Player::SetSkill(), SetVirtualItem(), Player::SetVisibleItemSlot(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Map::SummonCreature(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), Player::SummonPet(), Player::SwapQuestSlot(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_amberpine_woodsman::npc_amberpine_woodsmanAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), Player::UpdateArmorPenetration(), Player::UpdateDuelFlag(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), Player::UpdateExpertise(), Player::UpdateHonorFields(), Player::UpdateRating(), Player::UpdateShieldBlockValue(), Player::UpdateSkill(), Player::UpdateSkillPro(), Player::UpdateSkillsForLevel(), Player::UpdateSkillsToMaxSkillsForLevel(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), and npc_ranger_lilatha::WaypointReached().

◆ SetUnitFlag()

void Unit::SetUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

References flags, Object::SetFlag(), and UNIT_FIELD_FLAGS.

Referenced by BattlegroundAV::AddAVCreature(), Vehicle::AddPassenger(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::AddPortals(), Creature::AllLootRemovedFromCorpse(), npc_doctor::npc_doctorAI::BeginEvent(), boss_jarien::boss_jarien(), boss_sothos::boss_sothos(), GameObject::CastSpell(), Player::Create(), npc_mograine::npc_mograineAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_muru::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), advisor_baseAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), DisableRotate(), boss_thorim::boss_thorimAI::DisableThorim(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_amanishi_lookout::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_frozen_core::DoAction(), boss_felmyst::DoAction(), boss_kalecgos::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_illidan_stormrage::DoAction(), PetAI::DoAttack(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_erekem::boss_erekemAI::EnterEvadeMode(), boss_ichoron::boss_ichoronAI::EnterEvadeMode(), boss_lavanthor::boss_lavanthorAI::EnterEvadeMode(), boss_moragg::boss_moraggAI::EnterEvadeMode(), boss_xevozz::boss_xevozzAI::EnterEvadeMode(), boss_zuramat::boss_zuramatAI::EnterEvadeMode(), boss_anubarak_trial::boss_anubarak_trialAI::EnterEvadeMode(), boss_jaraxxus::boss_jaraxxusAI::EnterEvadeMode(), boss_gormok::boss_gormokAI::EnterEvadeMode(), boss_jormungarAI::EnterEvadeMode(), boss_icehowl::boss_icehowlAI::EnterEvadeMode(), SACDeactivateEvent::Execute(), boss_kaelthas::ExecuteMiddleEvent(), boss_ingvar_the_plunderer::FeignDeath(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_gen_model_visible::HandleEffectApply(), spell_gen_feign_death_all_flags::HandleEffectApply(), spell_gen_feign_death_no_dyn_flag::HandleEffectApply(), spell_gen_feign_death_no_prevent_emotes::HandleEffectApply(), AuraEffect::HandleFeignDeath(), BattlefieldWG::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleLogoutRequestOpcode(), spell_oculus_rider_aura::HandleOnEffectApply(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), npc_malchezaar_axe::Initialize(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::Initialize(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::InitializeAI(), boss_kiljaeden::InitializeAI(), npc_general_andorov::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), Player::InitStatsForLevel(), boss_kologarn::boss_kologarnAI::JustDied(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustEngagedWith(), boss_mimiron::boss_mimironAI::JustEngagedWith(), boss_felmyst::JustEngagedWith(), boss_novos::boss_novosAI::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_vaelastrasz::boss_vaelAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Mount(), npc_shattered_hand_scout::MoveInLineOfSight(), boss_kaelthas::MoveInLineOfSight(), npc_batrider::npc_batrider(), npc_blade_of_azzinoth::npc_blade_of_azzinoth(), npc_chess_move_trigger::npc_chess_move_trigger(), npc_hol_monument::npc_hol_monumentAI::npc_hol_monumentAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), npc_xt002_heart::npc_xt002_heartAI::npc_xt002_heartAI(), spell_halion_twilight_phasing_aura::OnApply(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), Creature::RefreshSwimmingFlag(), boss_keristrasza::RemovePrison(), npc_grimstone::npc_grimstoneAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_nefarian::Reset(), boss_nightbane::Reset(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), npc_zuljin_vortex::Reset(), npc_hallows_end_soh::Reset(), npc_ancient_wisp::Reset(), boss_cthun::Reset(), npc_depth_charge::npc_depth_chargeAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_death_ravager::npc_death_ravagerAI::Reset(), npc_giant_spotlight::npc_giant_spotlightAI::Reset(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_novos::boss_novosAI::Reset(), boss_tyrannus::boss_tyrannusAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_malygos::boss_malygosAI::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_massive_jormungar::npc_massive_jormungarAI::Reset(), npc_ferocious_rhino::npc_ferocious_rhinoAI::Reset(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::Reset(), npc_frenzied_worgen::npc_frenzied_worgenAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), npc_drakuru_shackles::npc_drakuru_shacklesAI::Reset(), boss_shade_of_akama::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), boss_warlord_kalithresh::Reset(), boss_broggok::Reset(), boss_kelidan_the_breaker::Reset(), boss_magtheridon::Reset(), boss_kaelthas::Reset(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_the_lurker_below::SchedulerPhaseOne(), Player::SendLoot(), SetCharm(), SetCharmedBy(), SetImmuneToNPC(), SetImmuneToPC(), SetInCombatState(), Player::SetIsSpectator(), SetMinion(), SetStunned(), SetSwim(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::ShowNpc(), npc_netherspite_infernal::SpellHit(), npc_harrison_jones::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_ionar::boss_ionarAI::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), npc_giant_claw_tentacle::Submerge(), boss_ouro::Submerge(), boss_ahune::Submerge(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and Creature::UpdateEntry().

◆ SetUnitFlag2()

◆ SetUnitMovementFlags()

◆ SetVirtualItem()

void Unit::SetVirtualItem ( uint32  slot,
uint32  itemId 
)
21199{
21200 if (slot >= MAX_EQUIPMENT_ITEMS)
21201 return;
21202
21204}

References MAX_EQUIPMENT_ITEMS, SetUInt32Value(), and UNIT_VIRTUAL_ITEM_SLOT_ID.

Referenced by ScriptedAI::SetEquipmentSlots().

◆ SetVisible()

void Unit::SetVisible ( bool  x)
14256{
14257 if (!x)
14259 else
14261
14263}
@ SEC_GAMEMASTER
Definition Common.h:59

References WorldObject::m_serverSideVisibility, SEC_GAMEMASTER, SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and UpdateObjectVisibility().

Referenced by boss_felmyst::boss_felmyst(), Creature::Create(), boss_muru::DamageTaken(), boss_alar::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), boss_archimonde::DoAction(), boss_felmyst::DoAction(), boss_kalecgos::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), HideNpcEvent::Execute(), UtherBatteredHiltEvent::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), BattlegroundSA::HandleKillUnit(), Battlefield::HideNpc(), boss_kiljaeden::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), npc_xt002_heart::npc_xt002_heartAI::JustDied(), boss_kalecgos::JustReachedHome(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), SmartAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_hazzarah::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), npc_enslaved_netherwing_drake::MovementInform(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::MovementInform(), boss_vazruden_the_herald::MovementInform(), npc_shattered_hand_scout::MovementInform(), npc_madrigosa::npc_madrigosa(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::npc_time_lost_proto_drakeAI(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnCreatureCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::PassengerBoarded(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_midnight::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_muru::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_archimonde::Reset(), boss_eye_of_cthun::Reset(), npc_murkdeep::npc_murkdeepAI::Reset(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_pos_leader::npc_pos_leaderAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_ionar::boss_ionarAI::Reset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::Reset(), npc_minigob_manabonk::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), boss_vazruden_the_herald::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), Battlefield::ShowNpc(), boss_ionar::boss_ionarAI::Split(), boss_warchief_kargath_bladefist::SummonedCreatureDies(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_madrigosa::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_taretha::npc_tarethaAI::WaypointReached().

◆ SetVisibleAura()

void Unit::SetVisibleAura ( uint8  slot,
AuraApplication aur 
)
inline

◆ SetWalk()

bool Unit::SetWalk ( bool  enable)
virtual

Reimplemented in Creature.

20574{
20575 if (enable == IsWalking())
20576 return false;
20577
20578 if (enable)
20580 else
20582
20584 return true;
20585}
bool IsWalking() const
Definition Unit.h:1624

References AddUnitMovementFlag(), IsWalking(), MOVEMENTFLAG_WALKING, propagateSpeedChange(), and RemoveUnitMovementFlag().

Referenced by debug_commandscript::HandleDebugMoveflagsCommand(), SetCharm(), and Creature::SetWalk().

◆ SetWaterWalking()

bool Unit::SetWaterWalking ( bool  enable,
bool  packetOnly = false 
)
virtual

Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players.

Reimplemented in Player, and Creature.

20653{
20655 return false;
20656
20657 if (enable)
20659 else
20661
20662 return true;
20663}
@ MOVEMENTFLAG_WATERWALKING
Definition UnitDefines.h:393

References AddUnitMovementFlag(), HasUnitMovementFlag(), MOVEMENTFLAG_WATERWALKING, and RemoveUnitMovementFlag().

Referenced by AuraEffect::HandleAuraWaterWalk(), debug_commandscript::HandleDebugMoveflagsCommand(), Player::SetWaterWalking(), and Creature::SetWaterWalking().

◆ SpellBaseDamageBonusDone()

int32 Unit::SpellBaseDamageBonusDone ( SpellSchoolMask  schoolMask)
11961{
11962 int32 DoneAdvertisedBenefit = 0;
11963
11965 for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
11966 if (((*i)->GetMiscValue() & schoolMask) != 0 &&
11967 (*i)->GetSpellInfo()->EquippedItemClass == -1 &&
11968 // -1 == any item class (not wand then)
11969 (*i)->GetSpellInfo()->EquippedItemInventoryTypeMask == 0)
11970 // 0 == any inventory type (not wand then)
11971 DoneAdvertisedBenefit += (*i)->GetAmount();
11972
11973 if (IsPlayer())
11974 {
11975 // Base value
11976 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
11977
11978 // Damage bonus from stats
11980 for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
11981 {
11982 if ((*i)->GetMiscValue() & schoolMask)
11983 {
11984 // stat used stored in miscValueB for this aura
11985 Stats usedStat = Stats((*i)->GetMiscValueB());
11986 DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
11987 }
11988 }
11989 // ... and attack power
11991 for (AuraEffectList::const_iterator i = mDamageDonebyAP.begin(); i != mDamageDonebyAP.end(); ++i)
11992 if ((*i)->GetMiscValue() & schoolMask)
11993 DoneAdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
11994 }
11995 return DoneAdvertisedBenefit;
11996}
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
Definition SpellAuraDefines.h:300
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
Definition SpellAuraDefines.h:237
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition SpellAuraDefines.h:76
uint32 GetBaseSpellPowerBonus()
Definition Player.h:1974

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellPowerBonus(), GetStat(), GetTotalAttackPowerValue(), Object::IsPlayer(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by spell_item_wraith_scythe_drain_life::CalculateDamage(), spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), Spell::EffectWeaponDmg(), spell_warl_life_tap::HandleDummy(), HandleDummyAuraProc(), spell_pal_seal_of_righteousness::HandleProc(), SpellDamageBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseDamageBonusTaken()

int32 Unit::SpellBaseDamageBonusTaken ( SpellSchoolMask  schoolMask,
bool  isDoT = false 
)
11999{
12000 int32 TakenAdvertisedBenefit = 0;
12001
12003 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
12004 if (((*i)->GetMiscValue() & schoolMask) != 0)
12005 {
12006 // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs
12007 // Xinef: required for hemorrhage & rupture / garrote
12008 if (isDoT && (*i)->GetBase()->IsUsingCharges() && !((*i)->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC))
12009 continue;
12010
12011 TakenAdvertisedBenefit += (*i)->GetAmount();
12012 }
12013
12014 return TakenAdvertisedBenefit;
12015}

References GetAuraEffectsByType(), PROC_FLAG_TAKEN_PERIODIC, and SPELL_AURA_MOD_DAMAGE_TAKEN.

Referenced by HandleDummyAuraProc(), spell_pal_seal_of_righteousness::HandleProc(), and SpellDamageBonusTaken().

◆ SpellBaseHealingBonusDone()

int32 Unit::SpellBaseHealingBonusDone ( SpellSchoolMask  schoolMask)
12726{
12727 int32 AdvertisedBenefit = 0;
12728
12730 for (AuraEffectList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i)
12731 if (!(*i)->GetMiscValue() || ((*i)->GetMiscValue() & schoolMask) != 0)
12732 AdvertisedBenefit += (*i)->GetAmount();
12733
12734 // Healing bonus of spirit, intellect and strength
12735 if (IsPlayer())
12736 {
12737 // Base value
12738 AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
12739
12740 // Healing bonus from stats
12742 for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
12743 {
12744 // stat used dependent from misc value (stat index)
12745 Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
12746 AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
12747 }
12748
12749 // ... and attack power
12751 for (AuraEffectList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i)
12752 if ((*i)->GetMiscValue() & schoolMask)
12753 AdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
12754 }
12755 return AdvertisedBenefit;
12756}
@ SPELL_AURA_MOD_HEALING_DONE
Definition SpellAuraDefines.h:198
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition SpellAuraDefines.h:238
@ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
Definition SpellAuraDefines.h:301

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellPowerBonus(), GetStat(), GetTotalAttackPowerValue(), Object::IsPlayer(), SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by CalculateSpellAmount(), SpellHealingBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseHealingBonusTaken()

int32 Unit::SpellBaseHealingBonusTaken ( SpellSchoolMask  schoolMask)
12759{
12760 int32 AdvertisedBenefit = 0;
12761
12763 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
12764 if (((*i)->GetMiscValue() & schoolMask) != 0)
12765 AdvertisedBenefit += (*i)->GetAmount();
12766
12767 return AdvertisedBenefit;
12768}
@ SPELL_AURA_MOD_HEALING
Definition SpellAuraDefines.h:178

References GetAuraEffectsByType(), and SPELL_AURA_MOD_HEALING.

Referenced by SpellHealingBonusTaken().

◆ SpellCriticalDamageBonus()

uint32 Unit::SpellCriticalDamageBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
12305{
12306 // Calculate critical bonus
12307 int32 crit_bonus = damage;
12308 float crit_mod = 0.0f;
12309
12310 switch (spellProto->DmgClass)
12311 {
12312 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
12315 crit_bonus += damage;
12316 break;
12317 default:
12318 crit_bonus += damage / 2; // for spells is 50%
12319 break;
12320 }
12321
12322 if (caster)
12323 {
12324 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask());
12325
12326 if (victim)
12327 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
12328
12329 if (crit_bonus != 0 && crit_mod != 0.0f)
12330 AddPct(crit_bonus, crit_mod);
12331
12332 crit_bonus -= damage;
12333
12334 // adds additional damage to critBonus (from talents)
12335 if (Player* modOwner = caster->GetSpellModOwner())
12336 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
12337
12338 crit_bonus += damage;
12339 }
12340
12341 return crit_bonus;
12342}

References AddPct(), SpellInfo::DmgClass, GetCreatureTypeMask(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellCriticalHealingBonus()

uint32 Unit::SpellCriticalHealingBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
12345{
12346 // Calculate critical bonus
12347 int32 crit_bonus;
12348 switch (spellProto->DmgClass)
12349 {
12350 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
12353 crit_bonus = damage;
12354 break;
12355 default:
12356 crit_bonus = damage / 2; // for spells is 50%
12357 break;
12358 }
12359
12360 if (caster)
12361 {
12362 if (victim)
12363 {
12364 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
12365 crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask));
12366 }
12367
12368 // adds additional damage to critBonus (from talents)
12369 // xinef: used for death knight death coil
12370 if (Player* modOwner = caster->GetSpellModOwner())
12371 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
12372 }
12373
12374 if (crit_bonus > 0)
12375 damage += crit_bonus;
12376
12377 if (caster)
12378 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT));
12379
12380 return damage;
12381}
@ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT
Definition SpellAuraDefines.h:113

References SpellInfo::DmgClass, GetCreatureTypeMask(), GetSpellModOwner(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by Spell::DoAllEffectOnTarget(), and AuraEffect::HandlePeriodicHealAurasTick().

◆ SpellDamageBonusDone()

uint32 Unit::SpellDamageBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
11639{
11640 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
11641 return pdamage;
11642
11643 // Some spells don't benefit from done mods
11644 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
11645 return pdamage;
11646
11647 // For totems get damage bonus from owner
11648 if (IsCreature())
11649 {
11650 if (IsTotem())
11651 {
11652 if (Unit* owner = GetOwner())
11653 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, effIndex, TotalMod, stack);
11654 }
11655 // Dancing Rune Weapon...
11656 else if (GetEntry() == 27893)
11657 {
11658 if (Unit* owner = GetOwner())
11659 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, TotalMod, stack) / 2;
11660 }
11661 }
11662
11663 // Done total percent damage auras
11664 float ApCoeffMod = 1.0f;
11665 int32 DoneTotal = 0;
11666 float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
11667
11668 // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controled Damage
11670 DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
11671
11672 // Some spells don't benefit from pct done mods
11673 if (!spellProto->HasAttribute(SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS))
11674 {
11675 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
11676 // Add flat bonus from spell damage versus
11678 }
11679
11680 // done scripted mod (take it from owner)
11681 Unit* owner = GetOwner() ? GetOwner() : this;
11682 int32 DoneAdvertisedBenefit = 0;
11683 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
11684 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
11685 {
11686 if (!(*i)->IsAffectedOnSpell(spellProto))
11687 continue;
11688
11689 switch ((*i)->GetMiscValue())
11690 {
11691 case 4418: // Increased Shock Damage
11692 case 4554: // Increased Lightning Damage
11693 case 4555: // Improved Moonfire
11694 case 5142: // Increased Lightning Damage
11695 case 5147: // Improved Consecration / Libram of Resurgence
11696 case 5148: // Idol of the Shooting Star
11697 case 6008: // Increased Lightning Damage
11698 case 8627: // Totem of Hex
11699 {
11700 DoneAdvertisedBenefit += (*i)->GetAmount();
11701 break;
11702 }
11703 }
11704 }
11705
11706 // Custom scripted damage
11707 switch (spellProto->SpellFamilyName)
11708 {
11709 case SPELLFAMILY_DRUID:
11710 {
11711 // Insect Swarm vs Item - Druid T8 Balance Relic
11712 if (spellProto->SpellFamilyFlags[0] & 0x00200000)
11713 {
11714 if (AuraEffect const* relicAurEff = GetAuraEffect(64950, EFFECT_0))
11715 {
11716 DoneAdvertisedBenefit += relicAurEff->GetAmount();
11717 }
11718 }
11719
11720 // Nourish vs Idol of the Flourishing Life
11721 if (spellProto->SpellFamilyFlags[1] & 0x02000000)
11722 {
11723 if (AuraEffect const* relicAurEff = GetAuraEffect(64949, EFFECT_0))
11724 {
11725 DoneAdvertisedBenefit += relicAurEff->GetAmount();
11726 }
11727 }
11728 break;
11729 }
11731 {
11732 // Sigil of the Vengeful Heart
11733 if (spellProto->SpellFamilyFlags[0] & 0x2000)
11734 {
11735 if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
11736 {
11737 AddPct(DoneTotal, aurEff->GetAmount());
11738 }
11739 }
11740
11741 // Impurity
11743 {
11744 AddPct(ApCoeffMod, aurEff->GetAmount());
11745 }
11746
11747 // Blood Boil - bonus for diseased targets
11748 if ((spellProto->SpellFamilyFlags[0] & 0x00040000) && victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, GetGUID()))
11749 {
11750 DoneTotal += 95;
11751 ApCoeffMod = 1.5835f;
11752 }
11753 break;
11754 }
11755 default:
11756 break;
11757 }
11758
11759 // Done fixed damage bonus auras
11760 DoneAdvertisedBenefit += SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
11761
11762 // Check for table values
11763 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
11764 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
11765 if (bonus)
11766 {
11767 if (damagetype == DOT)
11768 {
11769 coeff = bonus->dot_damage;
11770 if (bonus->ap_dot_bonus > 0)
11771 {
11772 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
11774 APbonus += GetTotalAttackPowerValue(attType);
11775 DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
11776 }
11777 }
11778 else
11779 {
11780 coeff = bonus->direct_damage;
11781 if (bonus->ap_bonus > 0)
11782 {
11783 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
11785 APbonus += GetTotalAttackPowerValue(attType);
11786 DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
11787 }
11788 }
11789 }
11790
11791 // Default calculation
11792 if (coeff && DoneAdvertisedBenefit)
11793 {
11794 float factorMod = CalculateLevelPenalty(spellProto) * stack;
11795
11796 if (Player* modOwner = GetSpellModOwner())
11797 {
11798 coeff *= 100.0f;
11799 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
11800 coeff /= 100.0f;
11801 }
11802
11803 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
11804 }
11805
11806 float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod;
11807 // apply spellmod to Done damage (flat and pct)
11808 if (Player* modOwner = GetSpellModOwner())
11809 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
11810
11811 return uint32(std::max(tmpDamage, 0.0f));
11812}
@ SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS
Definition SharedDefines.h:633
@ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS
Definition SpellAuraDefines.h:243
@ SPELLMOD_DOT
Definition SpellDefines.h:98
@ SPELLMOD_BONUS_MULTIPLIER
Definition SpellDefines.h:100
float GetSpellDamageMod(int32 Rank)
Definition Creature.cpp:1611
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:11307
float CalculateLevelPenalty(SpellInfo const *spellProto) const
Definition Unit.cpp:3040
Definition SpellMgr.h:324
float ap_dot_bonus
Definition SpellMgr.h:328
float dot_damage
Definition SpellMgr.h:326
float ap_bonus
Definition SpellMgr.h:327
float direct_damage
Definition SpellMgr.h:325

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, EFFECT_0, EFFECT_1, SpellInfo::Effects, GetAuraEffect(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetOwner(), SpellInfo::GetSchoolMask(), Creature::GetSpellDamageMod(), GetSpellModOwner(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::Id, IsControlledByPlayer(), Object::IsCreature(), IsGuardian(), IsPet(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_DAMAGE_CLASS_MELEE, SpellBaseDamageBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctDamageModsDone(), sSpellMgr, and Object::ToCreature().

Referenced by spell_warl_seed_of_corruption_aura::CalculateAmount(), AuraEffect::CalculateAmount(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), spell_warr_bloodthirst::HandleDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ SpellDamageBonusTaken()

uint32 Unit::SpellDamageBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint32  stack = 1 
)
11815{
11816 if (!spellProto || damagetype == DIRECT_DAMAGE)
11817 return pdamage;
11818
11819 int32 TakenTotal = 0;
11820 float TakenTotalMod = 1.0f;
11821
11822 // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
11823 // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
11825 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
11826 if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()))
11827 if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11828 AddPct(TakenTotalMod, (*i)->GetAmount());
11829
11830 TakenTotalMod = processDummyAuras(TakenTotalMod);
11831
11832 // From caster spells
11833 if (caster)
11834 {
11836 for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
11837 if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
11838 if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11839 AddPct(TakenTotalMod, (*i)->GetAmount());
11840 }
11841
11842 if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
11843 {
11844 int32 modifierMax = 0;
11845 int32 modifierMin = 0;
11847 for (AuraEffectList::const_iterator i = auraEffectList.begin(); i != auraEffectList.end(); ++i)
11848 {
11849 if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11850 continue;
11851
11852 // Only death knight spell with this aura
11853 if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
11854 if (!caster || caster->GetGUID() != (*i)->GetCasterGUID())
11855 continue;
11856
11857 if (mechanicMask & uint32(1 << (*i)->GetMiscValue()))
11858 {
11859 if ((*i)->GetAmount() > 0)
11860 {
11861 if ((*i)->GetAmount() > modifierMax)
11862 modifierMax = (*i)->GetAmount();
11863 }
11864 else if ((*i)->GetAmount() < modifierMin)
11865 modifierMin = (*i)->GetAmount();
11866 }
11867 }
11868
11869 AddPct(TakenTotalMod, modifierMax);
11870 AddPct(TakenTotalMod, modifierMin);
11871 }
11872
11873 int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask(), damagetype == DOT);
11874
11875 // Check for table values
11876 float coeff = 0;
11877 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
11878 if (bonus)
11879 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
11880
11881 // Default calculation
11882 if (TakenAdvertisedBenefit)
11883 {
11884 if (coeff <= 0.0f)
11885 {
11886 if (caster)
11887 coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
11888 else
11889 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
11890 }
11891
11892 float factorMod = CalculateLevelPenalty(spellProto) * stack;
11893 TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
11894 }
11895
11896 // No positive taken bonus, custom attr
11897 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
11898 {
11899 TakenTotal = 0;
11900 TakenTotalMod = 1.0f;
11901 }
11902
11903 // xinef: sanctified wrath talent
11904 if (caster && TakenTotalMod < 1.0f && caster->HasIgnoreTargetResistAura())
11905 {
11906 float ignoreModifier = 1.0f - TakenTotalMod;
11907 bool addModifier = false;
11909 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
11910 if ((*j)->GetMiscValue() & spellProto->SchoolMask)
11911 {
11912 ApplyPct(ignoreModifier, (*j)->GetAmount());
11913 addModifier = true;
11914 }
11915
11916 if (addModifier)
11917 TakenTotalMod += ignoreModifier;
11918 }
11919
11920 float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
11921
11922 return uint32(std::max(tmpDamage, 0.0f));
11923}
float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const
Definition Unit.cpp:17219

References AddPct(), ApplyPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, DOT, SpellBonusEntry::dot_damage, SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), Object::GetGUID(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasIgnoreTargetResistAura(), SpellInfo::Id, processDummyAuras(), SpellInfo::SchoolMask, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, sSpellMgr, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by DealMeleeDamage(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and spell_black_temple_l5_arcane_charge::PrepareSpellScript().

◆ SpellDoneCritChance()

float Unit::SpellDoneCritChance ( Unit const *  ,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
12018{
12019 // Mobs can't crit with spells.
12020 if (IsCreature() && !GetSpellModOwner())
12021 return -100.0f;
12022
12023 // not critting spell
12024 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
12025 return 0.0f;
12026
12027 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
12028 if (!skipEffectCheck && !spellProto->IsCritCapable())
12029 return 0.0f;
12030
12031 float crit_chance = 0.0f;
12032 switch (spellProto->DmgClass)
12033 {
12035 {
12036 if (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
12037 crit_chance = 0.0f;
12038 // For other schools
12039 else if (IsPlayer())
12040 crit_chance = GetFloatValue(static_cast<uint16>(PLAYER_SPELL_CRIT_PERCENTAGE1) + GetFirstSchoolInMask(schoolMask));
12041 else
12042 {
12043 crit_chance = (float)m_baseSpellCritChance;
12045 }
12046 break;
12047 }
12050 {
12051 if (IsPlayer())
12052 {
12053 switch (attackType)
12054 {
12055 case BASE_ATTACK:
12057 break;
12058 case OFF_ATTACK:
12060 break;
12061 case RANGED_ATTACK:
12063 break;
12064 default:
12065 break;
12066 }
12067 }
12068 else
12069 {
12070 crit_chance = 5.0f;
12073 }
12075 break;
12076 }
12077 // values overridden in spellmgr for lifebloom and earth shield
12079 default:
12080 return 0.0f;
12081 }
12082
12083 // percent done
12084 // only players use intelligence for critical chance computations
12085 if (Player* modOwner = GetSpellModOwner())
12086 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
12087
12088 // xinef: can be negative!
12089 return crit_chance;
12090}
@ SPELL_ATTR2_CANT_CRIT
Definition SharedDefines.h:485
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition SpellAuraDefines.h:134
@ SPELLMOD_CRITICAL_CHANCE
Definition SpellDefines.h:83
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition UpdateFields.h:354

References BASE_ATTACK, SpellInfo::DmgClass, GetFirstSchoolInMask(), Object::GetFloatValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellInfo::HasAttribute(), SpellInfo::Id, Object::IsCreature(), SpellInfo::IsCritCapable(), Object::IsPlayer(), m_baseSpellCritChance, OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_SCHOOL_MASK_NORMAL, and SPELLMOD_CRITICAL_CHANCE.

Referenced by Spell::DoAllEffectOnLaunchTarget().

◆ SpellHealingBonusDone()

uint32 Unit::SpellHealingBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
12476{
12477 // For totems get healing bonus from owner (statue isn't totem in fact)
12478 if (IsCreature() && IsTotem())
12479 if (Unit* owner = GetOwner())
12480 return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effIndex, TotalMod, stack);
12481
12482 // No bonus healing for potion spells
12483 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
12484 return healamount;
12485
12486 float ApCoeffMod = 1.0f;
12487 float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype);
12488 int32 DoneTotal = 0;
12489
12490 // done scripted mod (take it from owner)
12491 Unit* owner = GetOwner() ? GetOwner() : this;
12492 int32 DoneAdvertisedBenefit = 0;
12493 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12494 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12495 {
12496 if (!(*i)->IsAffectedOnSpell(spellProto))
12497 continue;
12498
12499 switch ((*i)->GetMiscValue())
12500 {
12501 case 4415: // Increased Rejuvenation Healing
12502 case 4953:
12503 DoneAdvertisedBenefit += (*i)->GetAmount();
12504 break;
12505 case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
12506 DoneAdvertisedBenefit += (*i)->GetAmount();
12507 break;
12508 }
12509 }
12510
12511 switch (spellProto->SpellFamilyName)
12512 {
12514 {
12515 // Impurity
12517 {
12518 AddPct(ApCoeffMod, aurEff->GetAmount());
12519 }
12520 break;
12521 }
12522 default:
12523 break;
12524 }
12525
12526 // Done fixed damage bonus auras
12527 DoneAdvertisedBenefit += SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
12528 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
12529
12530 // Check for table values
12531 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
12532 if (bonus)
12533 {
12534 if (damagetype == DOT)
12535 {
12536 coeff = bonus->dot_damage;
12537 if (bonus->ap_dot_bonus > 0)
12538 DoneTotal += int32(bonus->ap_dot_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
12539 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
12540 }
12541 else
12542 {
12543 coeff = bonus->direct_damage;
12544 if (bonus->ap_bonus > 0)
12545 DoneTotal += int32(bonus->ap_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
12546 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
12547 }
12548 }
12549 else
12550 {
12551 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
12552 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
12553 return healamount;
12554 }
12555
12556 // Default calculation
12557 if (DoneAdvertisedBenefit)
12558 {
12559 float factorMod = CalculateLevelPenalty(spellProto) * stack;
12560 if (Player* modOwner = GetSpellModOwner())
12561 {
12562 coeff *= 100.0f;
12563 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
12564 coeff /= 100.0f;
12565 }
12566 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
12567 }
12568
12569 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12570 {
12571 switch (spellProto->Effects[i].ApplyAuraName)
12572 {
12573 // Bonus healing does not apply to these spells
12576 DoneTotal = 0;
12577 break;
12578 }
12579 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
12580 DoneTotal = 0;
12581 }
12582
12583 // use float as more appropriate for negative values and percent applying
12584 float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
12585 // apply spellmod to Done amount
12586
12587 if (Player* modOwner = GetSpellModOwner())
12588 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
12589
12590 return uint32(std::max(heal, 0.0f));
12591}
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition SpellAuraDefines.h:125
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition Unit.cpp:12725
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition Unit.cpp:12383

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAttackPowerValue(), SpellInfo::Id, Object::IsCreature(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SpellBaseHealingBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_POTION, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctHealingModsDone(), and sSpellMgr.

Referenced by AuraEffect::CalculateAmount(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_dru_lifebloom::HandleDispel(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHealingBonusTaken()

uint32 Unit::SpellHealingBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint32  stack = 1 
)
12594{
12595 float TakenTotalMod = 1.0f;
12596 float minval = 0.0f;
12597
12598 // Healing taken percent
12599 if (!sScriptMgr->OnSpellHealingBonusTakenNegativeModifiers(this, caster, spellProto, minval))
12600 {
12602 }
12603
12604 if (minval)
12605 AddPct(TakenTotalMod, minval);
12606
12608 if (maxval)
12609 AddPct(TakenTotalMod, maxval);
12610
12611 // Tenacity increase healing % taken
12612 if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
12613 AddPct(TakenTotalMod, Tenacity->GetAmount());
12614
12615 // Healing Done
12616 int32 TakenTotal = 0;
12617
12618 // Taken fixed damage bonus auras
12619 int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask());
12620
12621 // Nourish cast, glyph of nourish
12622 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000 && caster)
12623 {
12624 bool any = false;
12625 bool hasglyph = caster->GetAuraEffectDummy(62971);
12627 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
12628 {
12629 if (((*i)->GetCasterGUID() == caster->GetGUID()))
12630 {
12631 SpellInfo const* spell = (*i)->GetSpellInfo();
12632 // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
12633 if (!any && spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0))
12634 {
12635 TakenTotalMod *= 1.2f;
12636 any = true;
12637 }
12638
12639 if (hasglyph)
12640 TakenTotalMod += 0.06f;
12641 }
12642 }
12643 }
12644
12645 if (damagetype == DOT)
12646 {
12647 // Healing over time taken percent
12648 float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
12649 if (minval_hot)
12650 AddPct(TakenTotalMod, minval_hot);
12651
12652 float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
12653 if (maxval_hot)
12654 AddPct(TakenTotalMod, maxval_hot);
12655 }
12656
12657 // Check for table values
12658 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
12659 float coeff = 0;
12660 float factorMod = 1.0f;
12661 if (bonus)
12662 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
12663 else
12664 {
12665 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
12666 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
12667 {
12668 healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f));
12669 return healamount;
12670 }
12671 }
12672
12673 // Default calculation
12674 if (TakenAdvertisedBenefit)
12675 {
12676 float TakenCoeff = 0.0f;
12677 if (coeff <= 0)
12678 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
12679
12680 factorMod *= CalculateLevelPenalty(spellProto) * int32(stack);
12681 if (Player* modOwner = GetSpellModOwner())
12682 {
12683 coeff *= 100.0f;
12684 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
12685 coeff /= 100.0f;
12686 }
12687
12688 TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod);
12689 }
12690
12691 if (caster)
12692 {
12694 for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
12695 if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
12696 AddPct(TakenTotalMod, (*i)->GetAmount());
12697 }
12698
12699 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12700 {
12701 switch (spellProto->Effects[i].ApplyAuraName)
12702 {
12703 // Bonus healing does not apply to these spells
12706 TakenTotal = 0;
12707 break;
12708 }
12709 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
12710 TakenTotal = 0;
12711 }
12712
12713 // No positive taken bonus, custom attr
12714 if ((spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f)
12715 {
12716 TakenTotal = 0;
12717 TakenTotalMod = 1.0f;
12718 }
12719
12720 float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod;
12721
12722 return uint32(std::max(heal, 0.0f));
12723}
@ SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS
Definition SharedDefines.h:631
@ SPELL_AURA_MOD_HEALING_RECEIVED
Definition SpellAuraDefines.h:346
@ SPELL_AURA_MOD_HEALING_PCT
Definition SpellAuraDefines.h:181
@ SPELL_AURA_MOD_HOT_PCT
Definition SpellAuraDefines.h:322
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition Unit.cpp:5958
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition Unit.cpp:5972
int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask)
Definition Unit.cpp:12758

References AddPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffect(), GetAuraEffectDummy(), GetAuraEffectsByType(), Object::GetGUID(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), SpellInfo::HasAttribute(), flag96::HasFlag(), SpellInfo::Id, MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HEALING_RECEIVED, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SpellBaseHealingBonusTaken(), SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, sScriptMgr, and sSpellMgr.

Referenced by spell_dru_lifebloom::AfterRemove(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_pri_renew::HandleApplyEffect(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHitResult() [1/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
Spell const *  spell,
bool  canReflect = false 
)
Todo:
: client not show miss log for this spells - so need find info for this in dbc and use it!
3536{
3537 SpellInfo const* spellInfo = spell->GetSpellInfo();
3538
3539 // Check for immune
3540 if (victim->IsImmunedToSpell(spellInfo, spell))
3541 {
3542 return SPELL_MISS_IMMUNE;
3543 }
3544
3545 // All positive spells can`t miss
3547 if ((spellInfo->IsPositive() || spellInfo->HasEffect(SPELL_EFFECT_DISPEL))
3548 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3549 {
3550 return SPELL_MISS_NONE;
3551 }
3552
3553 // Check for immune
3554 // xinef: check for school immunity only
3555 if (victim->IsImmunedToSchool(spell))
3556 {
3557 return SPELL_MISS_IMMUNE;
3558 }
3559
3560 if (this == victim)
3561 {
3562 return SPELL_MISS_NONE;
3563 }
3564
3565 // Return evade for units in evade mode
3566 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks() && !spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) &&
3568 {
3569 return SPELL_MISS_EVADE;
3570 }
3571
3572 // Try victim reflect spell
3573 if (CanReflect)
3574 {
3575 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3576 Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
3577 for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
3578 {
3579 if ((*i)->GetMiscValue() & spell->GetSpellSchoolMask())
3580 {
3581 reflectchance += (*i)->GetAmount();
3582 }
3583 }
3584
3585 if (reflectchance > 0 && roll_chance_i(reflectchance))
3586 {
3587 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3588 //ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3589 return SPELL_MISS_REFLECT;
3590 }
3591 }
3592
3593 switch (spellInfo->DmgClass)
3594 {
3597 return MeleeSpellHitResult(victim, spellInfo);
3599 {
3600 if (spellInfo->SpellFamilyName)
3601 {
3602 return SPELL_MISS_NONE;
3603 }
3604
3605 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3606 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3607 {
3608 if (spellInfo->Effects[i].Effect && spellInfo->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3609 {
3610 if (spellInfo->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3611 {
3612 return SPELL_MISS_NONE;
3613 }
3614 }
3615 }
3616 [[fallthrough]];
3617 }
3619 return MagicSpellHitResult(victim, spellInfo);
3620 }
3621
3622 return SPELL_MISS_NONE;
3623}
@ SPELL_EFFECT_DISPEL
Definition SharedDefines.h:816
@ SPELL_MISS_IMMUNE
Definition SharedDefines.h:1526
@ SPELL_MISS_EVADE
Definition SharedDefines.h:1525
@ SPELL_MISS_REFLECT
Definition SharedDefines.h:1530
uint32 DmgClass
Definition SpellInfo.h:389
SpellMissInfo MagicSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition Unit.cpp:3327
SpellMissInfo MeleeSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition Unit.cpp:3154

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, GetAuraEffectsByType(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), GetTotalAuraModifier(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, and Object::ToCreature().

◆ SpellHitResult() [2/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
SpellInfo const *  spell,
bool  canReflect = false 
)
Todo:
: client not show miss log for this spells - so need find info for this in dbc and use it!
3471{
3472 // Check for immune
3473 if (victim->IsImmunedToSpell(spell))
3474 return SPELL_MISS_IMMUNE;
3475
3476 // All positive spells can`t miss
3478 if ((spell->IsPositive() || spell->HasEffect(SPELL_EFFECT_DISPEL))
3479 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3480 return SPELL_MISS_NONE;
3481
3482 // Check for immune
3483 // xinef: check for school immunity only
3484 if (victim->IsImmunedToSchool(spell))
3485 return SPELL_MISS_IMMUNE;
3486
3487 if (this == victim)
3488 return SPELL_MISS_NONE;
3489
3490 // Return evade for units in evade mode
3491 if (victim->IsCreature() && victim->ToCreature()->IsEvadingAttacks() && !spell->HasAura(SPELL_AURA_CONTROL_VEHICLE)
3492 && !spell->HasAttribute(SPELL_ATTR0_CU_IGNORE_EVADE) && !spell->HasAttribute(SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT))
3493 return SPELL_MISS_EVADE;
3494
3495 // Try victim reflect spell
3496 if (CanReflect)
3497 {
3498 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3499 Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
3500 for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
3501 if ((*i)->GetMiscValue() & spell->GetSchoolMask())
3502 reflectchance += (*i)->GetAmount();
3503 if (reflectchance > 0 && roll_chance_i(reflectchance))
3504 {
3505 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3506 //ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3507 return SPELL_MISS_REFLECT;
3508 }
3509 }
3510
3511 switch (spell->DmgClass)
3512 {
3515 return MeleeSpellHitResult(victim, spell);
3517 {
3518 if (spell->SpellFamilyName)
3519 {
3520 return SPELL_MISS_NONE;
3521 }
3522 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3523 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3524 if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3525 if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3526 return SPELL_MISS_NONE;
3527 [[fallthrough]];
3528 }
3530 return MagicSpellHitResult(victim, spell);
3531 }
3532 return SPELL_MISS_NONE;
3533}

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), GetTotalAuraModifier(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Object::IsCreature(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, and Object::ToCreature().

Referenced by Spell::AddUnitTarget(), DealMeleeDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SpellPctDamageModsDone()

float Unit::SpellPctDamageModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
11308{
11309 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
11310 return 1.0f;
11311
11312 // Some spells don't benefit from done mods
11313 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
11314 return 1.0f;
11315
11316 // For totems get damage bonus from owner
11317 if (IsCreature())
11318 {
11319 if (IsTotem())
11320 {
11321 if (Unit* owner = GetOwner())
11322 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
11323 }
11324 // Dancing Rune Weapon...
11325 else if (GetEntry() == 27893)
11326 {
11327 if (Unit* owner = GetOwner())
11328 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
11329 }
11330 }
11331
11332 // Done total percent damage auras
11333 float DoneTotalMod = 1.0f;
11334
11336 for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
11337 {
11338 // prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
11339 if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1 &&
11340 !(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && (*i)->GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
11341 {
11342 continue;
11343 }
11344
11345 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11346 continue;
11347
11348 if (!sScriptMgr->IsNeedModSpellDamagePercent(this, *i, DoneTotalMod, spellProto))
11349 continue;
11350
11351 if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
11352 {
11353 if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
11354 AddPct(DoneTotalMod, (*i)->GetAmount());
11355 else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
11356 AddPct(DoneTotalMod, (*i)->GetAmount());
11357 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
11358 AddPct(DoneTotalMod, (*i)->GetAmount());
11359 }
11360 }
11361
11362 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
11364 for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
11365 if ((creatureTypeMask & uint32((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11366 AddPct(DoneTotalMod, (*i)->GetAmount());
11367
11368 // bonus against aurastate
11370 for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
11371 if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11372 AddPct(DoneTotalMod, (*i)->GetAmount());
11373
11374 // done scripted mod (take it from owner)
11375 Unit* owner = GetOwner() ? GetOwner() : this;
11376 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
11377 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
11378 {
11379 // Xinef: self cast is ommited (because of Rage of Rivendare)
11380 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11381 continue;
11382
11383 // xinef: Molten Fury should work on all spells
11384 switch ((*i)->GetMiscValue())
11385 {
11386 case 4920: // Molten Fury
11387 case 4919:
11388 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11389 AddPct(DoneTotalMod, (*i)->GetAmount());
11390 break;
11391 }
11392
11393 if (!(*i)->IsAffectedOnSpell(spellProto))
11394 continue;
11395
11396 switch ((*i)->GetMiscValue())
11397 {
11398 case 6917: // Death's Embrace
11399 case 6926:
11400 case 6928:
11401 {
11402 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11403 AddPct(DoneTotalMod, (*i)->GetAmount());
11404 break;
11405 }
11406 // Soul Siphon
11407 case 4992:
11408 case 4993:
11409 {
11410 // effect 1 m_amount
11411 int32 maxPercent = (*i)->GetAmount();
11412 // effect 0 m_amount
11413 int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 0);
11414 // count affliction effects and calc additional damage in percentage
11415 int32 modPercent = 0;
11416 AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
11417 for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
11418 {
11419 Aura const* aura = itr->second->GetBase();
11420 SpellInfo const* m_spell = aura->GetSpellInfo();
11421 if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags[1] & 0x0004071B || m_spell->SpellFamilyFlags[0] & 0x8044C402))
11422 continue;
11423 modPercent += stepPercent * aura->GetStackAmount();
11424 if (modPercent >= maxPercent)
11425 {
11426 modPercent = maxPercent;
11427 break;
11428 }
11429 }
11430 AddPct(DoneTotalMod, modPercent);
11431 break;
11432 }
11433 case 6916: // Death's Embrace
11434 case 6925:
11435 case 6927:
11436 if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
11437 AddPct(DoneTotalMod, (*i)->GetAmount());
11438 break;
11439 case 5481: // Starfire Bonus
11440 {
11441 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
11442 AddPct(DoneTotalMod, (*i)->GetAmount());
11443 break;
11444 }
11445 // Tundra Stalker
11446 // Merciless Combat
11447 case 7277:
11448 {
11449 // Merciless Combat
11450 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
11451 {
11452 if ((spellProto && spellProto->SpellFamilyFlags[0] & 0x2) || spellProto->SpellFamilyFlags[1] & 0x2 )
11453 if (!victim->HealthAbovePct(35))
11454 AddPct(DoneTotalMod, (*i)->GetAmount());
11455 }
11456 // Tundra Stalker
11457 else
11458 {
11459 // Frost Fever (target debuff)
11460 if (victim->HasAura(55095))
11461 AddPct(DoneTotalMod, (*i)->GetAmount());
11462 break;
11463 }
11464 break;
11465 }
11466 // Rage of Rivendare
11467 case 7293:
11468 {
11470 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
11471 break;
11472 }
11473 // Twisted Faith
11474 case 7377:
11475 {
11477 AddPct(DoneTotalMod, (*i)->GetAmount());
11478 break;
11479 }
11480 // Marked for Death
11481 case 7598:
11482 case 7599:
11483 case 7600:
11484 case 7601:
11485 case 7602:
11486 {
11487 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
11488 AddPct(DoneTotalMod, (*i)->GetAmount());
11489 break;
11490 }
11491 // Dirty Deeds
11492 case 6427:
11493 case 6428:
11494 case 6579:
11495 case 6580:
11496 {
11497 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11498 {
11499 // effect 0 has expected value but in negative state
11500 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
11501 AddPct(DoneTotalMod, bonus);
11502 }
11503 break;
11504 }
11505 }
11506 }
11507
11508 // Custom scripted damage
11509 switch (spellProto->SpellFamilyName)
11510 {
11511 case SPELLFAMILY_MAGE:
11512 // Ice Lance
11513 if (spellProto->SpellIconID == 186)
11514 {
11515 if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
11516 {
11517 // Glyph of Ice Lance
11518 if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
11519 DoneTotalMod *= 4.0f;
11520 else
11521 DoneTotalMod *= 3.0f;
11522 }
11523 }
11524
11525 // Torment the weak
11526 if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
11527 if (victim->HasAuraWithMechanic((1 << MECHANIC_SNARE) | (1 << MECHANIC_SLOW_ATTACK)))
11529 AddPct(DoneTotalMod, aurEff->GetAmount());
11530 break;
11531 case SPELLFAMILY_PRIEST:
11532 // Mind Flay
11533 if (spellProto->SpellFamilyFlags[0] & 0x800000)
11534 {
11535 // Glyph of Shadow Word: Pain
11536 if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
11537 // Increase Mind Flay damage if Shadow Word: Pain present on target
11539 AddPct(DoneTotalMod, aurEff->GetAmount());
11540
11541 // Twisted Faith - Mind Flay part
11543 // Increase Mind Flay damage if Shadow Word: Pain present on target
11545 AddPct(DoneTotalMod, aurEff->GetAmount());
11546 }
11547 // Smite
11548 else if (spellProto->SpellFamilyFlags[0] & 0x80)
11549 {
11550 // Glyph of Smite
11551 if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
11552 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
11553 AddPct(DoneTotalMod, aurEff->GetAmount());
11554 }
11555 // Shadow Word: Death
11556 else if (spellProto->SpellFamilyFlags[1] & 0x2)
11557 {
11558 // Glyph of Shadow Word: Death
11559 if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
11561 AddPct(DoneTotalMod, aurEff->GetAmount());
11562 }
11563
11564 break;
11566 // Judgement of Vengeance/Judgement of Corruption
11567 if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292)
11568 {
11569 // Get stack of Holy Vengeance/Blood Corruption on the target added by caster
11570 uint32 stacks = 0;
11572 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
11573 if (((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID() == GetGUID())
11574 {
11575 stacks = (*itr)->GetBase()->GetStackAmount();
11576 break;
11577 }
11578 // + 10% for each application of Holy Vengeance/Blood Corruption on the target
11579 if (stacks)
11580 AddPct(DoneTotalMod, 10 * stacks);
11581 }
11582 break;
11583 case SPELLFAMILY_DRUID:
11584 // Thorns
11585 if (spellProto->SpellFamilyFlags[0] & 0x100)
11586 {
11587 // Brambles
11588 if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
11589 AddPct(DoneTotalMod, aurEff->GetAmount());
11590 }
11591 break;
11593 // Fire and Brimstone
11594 if (spellProto->SpellFamilyFlags[1] & 0x00020040)
11596 {
11598 for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
11599 if ((*i)->GetSpellInfo()->SpellIconID == 3173)
11600 {
11601 AddPct(DoneTotalMod, (*i)->GetAmount());
11602 break;
11603 }
11604 }
11605 // Drain Soul - increased damage for targets under 25 % HP
11606 if (spellProto->SpellFamilyFlags[0] & 0x00004000)
11607 if (!victim->HealthAbovePct(25))
11608 DoneTotalMod *= 4;
11609 // Shadow Bite (15% increase from each dot)
11610 if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
11611 if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
11612 AddPct(DoneTotalMod, 15 * count);
11613 break;
11614 case SPELLFAMILY_HUNTER:
11615 // Steady Shot
11616 if (spellProto->SpellFamilyFlags[1] & 0x1)
11617 if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
11618 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
11619 AddPct(DoneTotalMod, aurEff->GetAmount());
11620 break;
11622 // Improved Icy Touch
11623 if (spellProto->SpellFamilyFlags[0] & 0x2)
11625 AddPct(DoneTotalMod, aurEff->GetAmount());
11626
11627 // Glacier Rot
11628 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
11630 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
11631 AddPct(DoneTotalMod, aurEff->GetAmount());
11632 break;
11633 }
11634
11635 return DoneTotalMod;
11636}
@ MECHANIC_SLOW_ATTACK
Definition SharedDefines.h:1333
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition SharedDefines.h:1293
@ AURA_STATE_CONFLAGRATE
Definition SharedDefines.h:1306
uint32 GetDiseasesByCaster(ObjectGuid casterGUID, uint8 mode=0)
Definition Unit.cpp:5844
bool HasAuraWithMechanic(uint32 mechanicMask) const
Definition Unit.cpp:5815
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5508
uint32 GetDoTsByCaster(ObjectGuid casterGUID) const
Definition Unit.cpp:5890

References AddPct(), AURA_STATE_CONFLAGRATE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, CalculateSpellDamage(), DIRECT_DAMAGE, DOT, EFFECT_0, SpellInfo::EquippedItemClass, GetAppliedAuras(), GetAuraEffect(), GetAuraEffectOfRankedSpell(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDoTsByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), Object::GetGUID(), GetLevel(), GetOwner(), GetOwnerGUID(), SpellInfo::GetSchoolMask(), Aura::GetSpellInfo(), Aura::GetStackAmount(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), HealthAbovePct(), Object::IsCreature(), IsPet(), IsTotem(), MECHANIC_SLOW_ATTACK, MECHANIC_SNARE, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM, SPELL_AURA_DUMMY, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sScriptMgr, Object::ToPlayer(), and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by AuraEffect::CalculatePeriodicData(), and SpellDamageBonusDone().

◆ SpellPctHealingModsDone()

float Unit::SpellPctHealingModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
12384{
12385 // For totems get healing bonus from owner (statue isn't totem in fact)
12386 if (IsCreature() && IsTotem())
12387 if (Unit* owner = GetOwner())
12388 return owner->SpellPctHealingModsDone(victim, spellProto, damagetype);
12389
12390 // Some spells don't benefit from done mods
12391 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
12392 return 1.0f;
12393
12394 // xinef: Some spells don't benefit from done mods
12395 if (spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS))
12396 return 1.0f;
12397
12398 // No bonus healing for potion spells
12399 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
12400 return 1.0f;
12401
12402 float DoneTotalMod = 1.0f;
12403
12404 // Healing done percent
12406 for (auto const& auraEff : mHealingDonePct)
12407 {
12408 if (!sScriptMgr->IsNeedModHealPercent(this, auraEff, DoneTotalMod, spellProto))
12409 continue;
12410
12411 AddPct(DoneTotalMod, auraEff->GetAmount());
12412 }
12413
12414 // done scripted mod (take it from owner)
12415 Unit* owner = GetOwner() ? GetOwner() : this;
12416 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12417 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12418 {
12419 if (!(*i)->IsAffectedOnSpell(spellProto))
12420 continue;
12421
12422 switch ((*i)->GetMiscValue())
12423 {
12424 case 21: // Test of Faith
12425 case 6935:
12426 case 6918:
12427 if (victim->HealthBelowPct(50))
12428 AddPct(DoneTotalMod, (*i)->GetAmount());
12429 break;
12430 case 7798: // Glyph of Regrowth
12431 {
12433 AddPct(DoneTotalMod, (*i)->GetAmount());
12434 break;
12435 }
12436
12437 case 7871: // Glyph of Lesser Healing Wave
12438 {
12439 // xinef: affected by any earth shield
12440 if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0))
12441 AddPct(DoneTotalMod, (*i)->GetAmount());
12442 break;
12443 }
12444 default:
12445 break;
12446 }
12447 }
12448
12449 switch (spellProto->SpellFamilyName)
12450 {
12452 // Talents and glyphs for healing stream totem
12453 if (spellProto->Id == 52042)
12454 {
12455 // Glyph of Healing Stream Totem
12456 if (AuraEffect* dummy = owner->GetAuraEffect(55456, EFFECT_0))
12457 AddPct(DoneTotalMod, dummy->GetAmount());
12458
12459 // Healing Stream totem - Restorative Totems
12460 if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1))
12461 AddPct(DoneTotalMod, aurEff->GetAmount());
12462 }
12463 break;
12464 case SPELLFAMILY_PRIEST:
12465 // T9 HEALING 4P, empowered renew instant heal
12466 if (spellProto->Id == 63544)
12467 if (AuraEffect* aurEff = GetAuraEffect(67202, EFFECT_0))
12468 AddPct(DoneTotalMod, aurEff->GetAmount());
12469 break;
12470 }
12471
12472 return DoneTotalMod;
12473}
@ SPELL_AURA_MOD_HEALING_DONE_PERCENT
Definition SpellAuraDefines.h:199

References AddPct(), EFFECT_0, GetAuraEffect(), GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), SpellInfo::HasAttribute(), HealthBelowPct(), SpellInfo::Id, Object::IsCreature(), IsTotem(), SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_DUMMY, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SpellInfo::SpellFamilyName, and sScriptMgr.

Referenced by AuraEffect::CalculatePeriodicData(), and SpellHealingBonusDone().

◆ SpellTakenCritChance()

float Unit::SpellTakenCritChance ( Unit const *  caster,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
float  doneChance,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
12093{
12094 // not critting spell
12095 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
12096 return 0.0f;
12097
12098 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
12099 if (!skipEffectCheck && !spellProto->IsCritCapable())
12100 return 0.0f;
12101
12102 float crit_chance = doneChance;
12103 switch (spellProto->DmgClass)
12104 {
12106 {
12107 if (!spellProto->IsPositive())
12108 {
12109 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
12110 // xinef: apply max and min only
12112 {
12115 }
12116
12117 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_SPELL);
12118 }
12119 // scripted (increase crit chance ... against ... target by x%
12120 if (caster)
12121 {
12122 AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12123 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12124 {
12125 if (!((*i)->IsAffectedOnSpell(spellProto)))
12126 continue;
12127 int32 modChance = 0;
12128 switch ((*i)->GetMiscValue())
12129 {
12130 // Shatter
12131 case 911:
12132 modChance += 16;
12133 [[fallthrough]];
12134 case 910:
12135 modChance += 17;
12136 [[fallthrough]];
12137 case 849:
12138 modChance += 17;
12139 if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
12140 break;
12141 crit_chance += modChance;
12142 break;
12143 case 7917: // Glyph of Shadowburn
12144 if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
12145 crit_chance += (*i)->GetAmount();
12146 break;
12147 case 7997: // Renewed Hope
12148 case 7998:
12149 if (HasAura(6788))
12150 crit_chance += (*i)->GetAmount();
12151 break;
12152 default:
12153 break;
12154 }
12155 }
12156 // Custom crit by class
12157 switch (spellProto->SpellFamilyName)
12158 {
12159 case SPELLFAMILY_MAGE:
12160 // Glyph of Fire Blast
12161 if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12)
12163 if (AuraEffect const* aurEff = caster->GetAuraEffect(56369, EFFECT_0))
12164 crit_chance += aurEff->GetAmount();
12165 break;
12166 case SPELLFAMILY_DRUID:
12167 // Improved Faerie Fire
12169 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0))
12170 crit_chance += aurEff->GetAmount();
12171
12172 // cumulative effect - don't break
12173
12174 // Starfire
12175 if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485)
12176 {
12177 // Improved Insect Swarm
12178 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
12180 crit_chance += aurEff->GetAmount();
12181 break;
12182 }
12183 break;
12184 case SPELLFAMILY_ROGUE:
12185 // Shiv-applied poisons can't crit
12186 if (caster->FindCurrentSpellBySpellId(5938))
12187 crit_chance = 0.0f;
12188 break;
12190 // Flash of light
12191 if (spellProto->SpellFamilyFlags[0] & 0x40000000)
12192 {
12193 // Sacred Shield
12194 if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID()))
12195 crit_chance += aura->GetAmount();
12196 break;
12197 }
12198 // Exorcism
12199 else if (spellProto->GetCategory() == 19)
12200 {
12202 return 100.0f;
12203 break;
12204 }
12205 break;
12206 case SPELLFAMILY_SHAMAN:
12207 // Lava Burst
12208 if (spellProto->SpellFamilyFlags[1] & 0x00001000)
12209 {
12210 if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID()))
12212 return 100.0f;
12213 break;
12214 }
12215 break;
12216 }
12217 }
12218 break;
12219 }
12221 // Custom crit by class
12222 if (caster)
12223 {
12224 switch (spellProto->SpellFamilyName)
12225 {
12226 case SPELLFAMILY_DRUID:
12227 // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets
12228 if (spellProto->SpellFamilyFlags[0] & 0x00800000 && spellProto->SpellIconID == 1680 && HasAuraState(AURA_STATE_BLEEDING))
12229 {
12230 if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1))
12231 crit_chance += rendAndTear->GetAmount();
12232 break;
12233 }
12234 break;
12236 // Victory Rush
12237 if (spellProto->SpellFamilyFlags[1] & 0x100)
12238 {
12239 // Glyph of Victory Rush
12240 if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0))
12241 crit_chance += aurEff->GetAmount();
12242 break;
12243 }
12244 break;
12245 }
12246 }
12247
12248 // 100% critical chance against sitting target
12250 {
12251 return 100.0f;
12252 }
12253 [[fallthrough]];
12255 {
12256 // flat aura mods
12257 if (attackType == RANGED_ATTACK)
12259 else
12261
12262 // reduce crit chance from Rating for players
12263 if (attackType != RANGED_ATTACK)
12264 {
12265 // xinef: little hack, crit chance dont require caster to calculate, pass victim
12266 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_MELEE);
12267 }
12268 else
12269 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_RANGED);
12270
12271 // Apply crit chance from defence skill
12272 if (caster)
12273 crit_chance += (int32(caster->GetMaxSkillValueForLevel(this)) - int32(GetDefenseSkillValue(caster))) * 0.04f;
12274
12275 break;
12276 }
12277 // values overridden in spellmgr for lifebloom and earth shield
12279 default:
12280 return 0.0f;
12281 }
12282
12283 if (caster)
12284 {
12286 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
12287 {
12288 if (caster->GetGUID() != (*i)->GetCasterGUID())
12289 continue;
12290
12291 crit_chance += (*i)->GetAmount();
12292 }
12293 }
12294
12295 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
12296 // xinef: should be calculated at the end
12297 if (!spellProto->IsPositive())
12299
12300 // xinef: can be negative!
12301 return crit_chance;
12302}
uint32 const CREATURE_TYPEMASK_DEMON_OR_UNDEAD
Definition SharedDefines.h:2643
@ MECHANIC_KNOCKOUT
Definition SharedDefines.h:1339
@ AURA_STATE_BLEEDING
Definition SharedDefines.h:1310
@ AURA_STATE_FAERIE_FIRE
Definition SharedDefines.h:1304
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition Unit.cpp:6009
bool HasAttackerSpellCritChanceAura() const
Definition Unit.h:1743
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition Unit.cpp:6023

References ApplyResilience(), AURA_STATE_BLEEDING, AURA_STATE_FAERIE_FIRE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_35_PERCENT, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CREATURE_TYPEMASK_DEMON_OR_UNDEAD, SpellInfo::DmgClass, EFFECT_0, FindCurrentSpellBySpellId(), GetAuraEffect(), GetAuraEffectsByType(), SpellInfo::GetCategory(), GetCreatureTypeMask(), GetDefenseSkillValue(), GetDummyAuraEffect(), Object::GetGUID(), Object::GetGUID(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxSkillValueForLevel(), getStandState(), GetTotalAuraModifier(), HasAttackerSpellCritChanceAura(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), SpellInfo::IsCritCapable(), Object::IsPlayer(), SpellInfo::IsPositive(), IsSitState(), MECHANIC_KNOCKOUT, MECHANIC_STUN, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_DRUID, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, and UNIT_STAND_STATE_SLEEP.

Referenced by AuraEffect::CalcPeriodicCritChance(), and Spell::DoAllEffectOnLaunchTarget().

◆ StartReactiveTimer()

void Unit::StartReactiveTimer ( ReactiveType  reactive)
inline
#define REACTIVE_TIMER_START
Definition Unit.h:590

References m_reactiveTimer, and REACTIVE_TIMER_START.

Referenced by ProcDamageAndSpellFor().

◆ StopAttackFaction()

void Unit::StopAttackFaction ( uint32  faction_id)
20193{
20194 if (Unit* victim = GetVictim())
20195 {
20196 if (victim->GetFactionTemplateEntry()->faction == faction_id)
20197 {
20198 AttackStop();
20199 if (IsNonMeleeSpellCast(false))
20201
20202 // melee and ranged forced attack cancel
20203 if (IsPlayer())
20205 }
20206 }
20207
20208 AttackerSet const& attackers = getAttackers();
20209 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
20210 {
20211 if ((*itr)->GetFactionTemplateEntry()->faction == faction_id)
20212 {
20213 (*itr)->AttackStop();
20214 itr = attackers.begin();
20215 }
20216 else
20217 ++itr;
20218 }
20219
20221
20222 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
20223 (*itr)->StopAttackFaction(faction_id);
20224}
void deleteReferencesForFaction(uint32 faction)
Definition HostileRefMgr.cpp:162

References AttackStop(), HostileRefMgr::deleteReferencesForFaction(), getAttackers(), getHostileRefMgr(), GetVictim(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by AuraEffect::HandleForceReaction().

◆ StopAttackingInvalidTarget()

void Unit::StopAttackingInvalidTarget ( )
20227{
20228 AttackerSet const& attackers = getAttackers();
20229 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
20230 {
20231 Unit* attacker = (*itr);
20232 if (!attacker->IsValidAttackTarget(this))
20233 {
20234 attacker->AttackStop();
20235 if (attacker->IsPlayer())
20236 {
20238 }
20239
20240 for (Unit* controled : attacker->m_Controlled)
20241 {
20242 if (controled->GetVictim() == this && !controled->IsValidAttackTarget(this))
20243 {
20244 controled->AttackStop();
20245 }
20246 }
20247
20248 itr = attackers.begin();
20249 }
20250 else
20251 {
20252 ++itr;
20253 }
20254 }
20255}

References AttackStop(), getAttackers(), Object::IsPlayer(), IsValidAttackTarget(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by RemoveCharmedBy(), and SetCharmedBy().

◆ StopMoving()

void Unit::StopMoving ( )
16674{
16676
16677 // not need send any packets if not in world or not moving
16678 if (!IsInWorld())
16679 return;
16680
16681 if (movespline->Finalized())
16682 return;
16683
16684 // Update position now since Stop does not start a new movement that can be updated later
16685 if (movespline->HasStarted())
16687
16688 Movement::MoveSplineInit init(this);
16689 init.Stop();
16690}
bool HasStarted() const
Definition MoveSpline.h:129
void UpdateSplinePosition()
Definition Unit.cpp:607

References ClearUnitState(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::HasStarted(), Object::IsInWorld(), movespline, Movement::MoveSplineInit::Stop(), UNIT_STATE_MOVING, and UpdateSplinePosition().

Referenced by npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_alar::ConstructWaypointsAndMove(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::DamageTaken(), npc_vrykul_skeleton::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), ScriptedAI::DoCastSpell(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), WorldSession::HandlePetActionHelper(), RotateMovementGenerator::Initialize(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_kologarn::boss_kologarnAI::JustDied(), boss_swamplord_muselek::JustEngagedWith(), boss_janalai::JustEngagedWith(), Player::LeaveBattleground(), SmartAI::MoveAway(), boss_felmyst::MovementInform(), boss_headless_horseman::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), PauseMovement(), SmartAI::PausePath(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), RemoveCharmedBy(), Creature::RemoveCorpse(), boss_felblood_kaelthas::Reset(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), boss_leotheras_the_blind::Reset(), IdleMovementGenerator::Reset(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), SmartAI::SetCombatMove(), SetConfused(), boss_victor_nefarius::boss_victor_nefariusAI::SetData(), setDeathState(), SetFeared(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), SetRooted(), npc_magister_aledis::sGossipSelect(), npc_harrison_jones::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_heigan::boss_heiganAI::StartFightPhase(), SmartAI::StopFollow(), SmartAI::StopPath(), CreatureAI::TriggerAlert(), Pet::Update(), TimedFleeingMovementGenerator::Update(), boss_onyxia::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), and PetAI::UpdateAI().

◆ StopMovingOnCurrentPos()

void Unit::StopMovingOnCurrentPos ( )
16713{
16715
16716 // not need send any packets if not in world
16717 if (!IsInWorld())
16718 return;
16719
16720 DisableSpline(); // pussywizard: required so Launch() won't recalculate position from previous spline
16721 Movement::MoveSplineInit init(this);
16722 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
16723 init.SetFacing(GetOrientation());
16724 init.Launch();
16725}

References ClearUnitState(), DisableSpline(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsInWorld(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and UNIT_STATE_MOVING.

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_illidan_stormrage::DoAction(), npc_maiev_illidan::DoAction(), boss_alar::DoDiveBomb(), UtherBatteredHiltEvent::Execute(), WorldSession::HandlePetActionHelper(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::HandleSpeedChangeIfNeeded(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), boss_janalai::Reset(), boss_skadi::boss_skadiAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), SetRooted(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), Creature::Update(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), and npc_vortex_ride::npc_vortex_rideAI::UpdateAI().

◆ Talk() [1/2]

void Unit::Talk ( std::string_view  text,
ChatMsg  msgType,
Language  language,
float  textRange,
WorldObject const *  target 
)
virtual
21155{
21156 Acore::CustomChatTextBuilder builder(this, msgType, text, language, target);
21159 Cell::VisitWorldObjects(this, worker, textRange);
21160}
Definition ChatTextBuilder.h:49
Definition GridNotifiers.h:1707
Definition GridNotifiers.h:592
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:192

References Cell::VisitWorldObjects().

Referenced by spell_inoculate_nestlewood_owlkin::HandleEffectRemove(), and spell_the_flag_of_ownership::HandleScript().

◆ Talk() [2/2]

void Unit::Talk ( uint32  textId,
ChatMsg  msgType,
float  textRange,
WorldObject const *  target 
)
virtual
21207{
21208 if (!sObjectMgr->GetBroadcastText(textId))
21209 {
21210 LOG_ERROR("entities.unit", "Unit::Talk: `broadcast_text` (ID: {}) was not found", textId);
21211 return;
21212 }
21213
21214 Acore::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target);
21217 Cell::VisitWorldObjects(this, worker, textRange);
21218}
Definition ChatTextBuilder.h:31

References getGender(), LOG_ERROR, sObjectMgr, and Cell::VisitWorldObjects().

◆ TauntApply()

void Unit::TauntApply ( Unit victim)
14688{
14689 ASSERT(IsCreature());
14690
14691 if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster()))
14692 return;
14693
14694 if (!CanHaveThreatList())
14695 return;
14696
14697 Creature* creature = ToCreature();
14698
14699 if (creature->HasReactState(REACT_PASSIVE))
14700 return;
14701
14702 Unit* target = GetVictim();
14703 if (target && target == taunter)
14704 return;
14705
14706 SetInFront(taunter);
14707 SetGuidValue(UNIT_FIELD_TARGET, taunter->GetGUID());
14708
14709 if (creature->IsAIEnabled)
14710 creature->AI()->AttackStart(taunter);
14711
14712 //m_ThreatMgr.tauntApply(taunter);
14713}
void SetInFront(WorldObject const *target)
Definition Unit.cpp:20544

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), Object::GetGUID(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Object::IsCreature(), Player::IsGameMaster(), Object::IsPlayer(), REACT_PASSIVE, Object::SetGuidValue(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), and UNIT_FIELD_TARGET.

Referenced by AuraEffect::HandleModTaunt(), and boss_razorgore::boss_razorgoreAI::OnCharmed().

◆ TauntFadeOut()

void Unit::TauntFadeOut ( Unit taunter)
14718{
14719 ASSERT(IsCreature());
14720
14721 if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster()))
14722 return;
14723
14724 if (!CanHaveThreatList())
14725 return;
14726
14727 Creature* creature = ToCreature();
14728
14729 if (creature->HasReactState(REACT_PASSIVE))
14730 return;
14731
14732 Unit* target = GetVictim();
14733 if (!target || target != taunter)
14734 return;
14735
14737 {
14738 if (creature->IsAIEnabled)
14740 return;
14741 }
14742
14743 target = creature->SelectVictim(); // might have more taunt auras remaining
14744
14745 if (target && target != taunter)
14746 {
14748 SetInFront(target);
14749 if (creature->IsAIEnabled)
14750 creature->AI()->AttackStart(target);
14751 }
14752}
@ EVADE_REASON_NO_HOSTILES
Definition CreatureAI.h:89
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition CreatureAI.cpp:208
Unit * SelectVictim()
Definition Unit.cpp:14756
bool isThreatListEmpty() const
Definition ThreatMgr.h:224

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), CreatureAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Object::GetGUID(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Object::IsCreature(), Player::IsGameMaster(), Object::IsPlayer(), ThreatMgr::isThreatListEmpty(), m_ThreatMgr, REACT_PASSIVE, Creature::SelectVictim(), Object::SetGuidValue(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), and UNIT_FIELD_TARGET.

Referenced by AuraEffect::HandleModTaunt(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ TextEmote() [1/2]

◆ TextEmote() [2/2]

void Unit::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

Reimplemented in Player.

21231{
21232 Talk(textId, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
21233}

References CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_RAID_BOSS_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToPet()

◆ ToTempSummon() [1/2]

TempSummon * Unit::ToTempSummon ( )
inline
702{ if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return nullptr; }

References IsSummon().

Referenced by CreatureAI::_EnterEvadeMode(), _ExitVehicle(), npc_living_mojo::npc_living_mojoAI::AttackStart(), WorldObject::CanSeeOrDetect(), Spell::CheckCast(), Spell::CheckEffectTarget(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Creature::DespawnOnEvade(), Creature::DespawnOrUnsummon(), npc_bone_spike::npc_bone_spikeAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), ThreatMgr::DoAddThreat(), Spell::EffectScriptEffect(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), npc_raging_flames::FixateRandomTarget(), boss_headless_horseman_head::GetOwner(), GetSpellModOwner(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner(), CreatureAI::GetSummoner(), Creature::GetSummonerGUID(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pilgrims_bounty_pass_generic::HandleDummy(), WorldSession::HandlePetActionHelper(), spell_pri_lightwell::HandleScriptEffect(), spell_q11026_a11051_banish_the_demons::HandleScriptEffect(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_pet_gen_imp_in_a_bottle::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), npc_raging_spirit::npc_raging_spiritAI::JustDied(), boss_freya_iron_root::boss_freya_iron_rootAI::JustDied(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::JustDied(), npc_counselor_talbot::npc_counselor_talbotAI::JustDied(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::npc_pet_dk_ghoulAI::JustDied(), npc_pet_pri_shadowfiend::JustDied(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustEngagedWith(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_collapsing_star::npc_collapsing_starAI::JustSummoned(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::JustSummoned(), boss_supremus::JustSummoned(), Kill(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_netherspite_infernal::KilledUnit(), npc_living_mojo::npc_living_mojoAI::MoveInLineOfSight(), WaypointMovementGenerator< Creature >::MovementInform(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::MovementInform(), npc_leryssa::npc_leryssaAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), npc_midsummer_bonfire::npc_midsummer_bonfire(), npc_midsummer_ribbon_pole_target::npc_midsummer_ribbon_pole_target(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), BattlefieldWG::OnCreatureCreate(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), RemoveAllControlled(), RemoveAllMinionsByEntry(), spell_gen_defend::RemoveDummyFromDriver(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), npc_voidtraveler::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), Spell::SendSpellGo(), Spell::SendSpellStart(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_pilgrims_bounty_plate::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SummonedCreatureDies(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_freya_ward::npc_freya_wardAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::UpdateAI(), npc_feedin_da_goolz::npc_feedin_da_goolzAI::UpdateAI(), Player::VehicleSpellInitialize(), and npc_frosthound::npc_frosthoundAI::WaypointReached().

◆ ToTempSummon() [2/2]

const TempSummon * Unit::ToTempSummon ( ) const
inline
703{ if (IsSummon()) return reinterpret_cast<const TempSummon*>(this); else return nullptr; }

References IsSummon().

◆ ToTotem()

Totem * Unit::ToTotem ( )
inline
701{ if (IsTotem()) return reinterpret_cast<Totem*>(this); else return nullptr; }
Definition Totem.h:51

References IsTotem().

Referenced by _UnapplyAura(), Spell::EffectDestroyAllTotems(), WorldSession::HandleTotemDestroyed(), SetMinion(), Spell::SummonGuardian(), and TotemAI::UpdateAI().

◆ TriggerAurasProcOnEvent() [1/3]

void Unit::TriggerAurasProcOnEvent ( CalcDamageInfo damageInfo)
16567{
16568 DamageInfo dmgInfo = DamageInfo(damageInfo);
16569 TriggerAurasProcOnEvent(nullptr, nullptr, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, nullptr, &dmgInfo, nullptr);
16570}
void TriggerAurasProcOnEvent(CalcDamageInfo &damageInfo)
Definition Unit.cpp:16566

References CalcDamageInfo::procAttacker, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, CalcDamageInfo::target, and TriggerAurasProcOnEvent().

Referenced by TriggerAurasProcOnEvent(), and TriggerAurasProcOnEvent().

◆ TriggerAurasProcOnEvent() [2/3]

void Unit::TriggerAurasProcOnEvent ( ProcEventInfo eventInfo,
std::list< AuraApplication * > &  procAuras 
)
16592{
16593 for (std::list<AuraApplication*>::iterator itr = aurasTriggeringProc.begin(); itr != aurasTriggeringProc.end(); ++itr)
16594 {
16595 if (!(*itr)->GetRemoveMode())
16596 (*itr)->GetBase()->TriggerProcOnEvent(*itr, eventInfo);
16597 }
16598}

◆ TriggerAurasProcOnEvent() [3/3]

void Unit::TriggerAurasProcOnEvent ( std::list< AuraApplication * > *  myProcAuras,
std::list< AuraApplication * > *  targetProcAuras,
Unit actionTarget,
uint32  typeMaskActor,
uint32  typeMaskActionTarget,
uint32  spellTypeMask,
uint32  spellPhaseMask,
uint32  hitMask,
Spell spell,
DamageInfo damageInfo,
HealInfo healInfo 
)
16573{
16574 // prepare data for self trigger
16575 ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
16576 std::list<AuraApplication*> myAurasTriggeringProc;
16577 GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
16578
16579 // prepare data for target trigger
16580 ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
16581 std::list<AuraApplication*> targetAurasTriggeringProc;
16582 if (typeMaskActionTarget)
16583 GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
16584
16585 TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
16586
16587 if (typeMaskActionTarget)
16588 TriggerAurasProcOnEvent(targetProcEventInfo, targetAurasTriggeringProc);
16589}
void GetProcAurasTriggeredOnEvent(std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
Definition Unit.cpp:16536

References GetProcAurasTriggeredOnEvent(), and TriggerAurasProcOnEvent().

◆ UnsummonAllTotems()

void Unit::UnsummonAllTotems ( bool  onDeath = false)
11229{
11230 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
11231 {
11232 if (!m_SummonSlot[i])
11233 {
11234 continue;
11235 }
11236
11237 if (Creature* OldTotem = GetMap()->GetCreature(m_SummonSlot[i]))
11238 {
11239 if (OldTotem->IsSummon())
11240 {
11241 if (!(onDeath && !IsPlayer() && OldTotem->IsGuardian()))
11242 {
11243 OldTotem->ToTempSummon()->UnSummon();
11244 }
11245 }
11246 }
11247 }
11248}

References WorldObject::GetMap(), Object::IsPlayer(), m_SummonSlot, and MAX_SUMMON_SLOT.

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ Update()

void Unit::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

383{
384 sScriptMgr->OnUnitUpdate(this, p_time);
385
386 // WARNING! Order of execution here is important, do not change.
387 // Spells must be processed with event system BEFORE they go to _UpdateSpells.
388 // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
389 WorldObject::Update(p_time);
390
391 if (!IsInWorld())
392 return;
393
394 // pussywizard:
395 if (!IsPlayer() || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate))
396 {
398 {
400 {
402 //ExecuteDelayedUnitRelocationEvent();
404 }
405 else
407 }
409 {
410 if (m_delayed_unit_ai_notify_timer <= p_time)
411 {
414 }
415 else
417 }
418 }
419
420 _UpdateSpells( p_time );
421
422 if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
424
425 // update combat timer only for players and pets (only pets with PetAI)
427 {
428 // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
429 // targets without stopping half way there and running off.
430 // These flags are reset after target dies or another command is given.
432 {
433 // m_CombatTimer set at aura start and it will be freeze until aura removing
434 if (m_CombatTimer <= p_time)
436 else
437 m_CombatTimer -= p_time;
438 }
439 }
440
443 {
444 while (!extraAttacksTargets.empty())
445 {
446 auto itr = extraAttacksTargets.begin();
447 ObjectGuid targetGuid = itr->first;
448 uint32 count = itr->second;
449 extraAttacksTargets.erase(itr);
450 if (Unit* victim = ObjectAccessor::GetUnit(*this, targetGuid))
451 {
453 || victim->IsWithinMeleeRange(this))
454 {
455 HandleProcExtraAttackFor(victim, count);
456 }
457 }
458 }
460 }
461
462 // not implemented before 3.0.2
463 // xinef: if attack time > 0, reduce by diff
464 // if on next update, attack time < 0 assume player didnt attack - set to 0
465 bool suspendAttackTimer = false;
466 bool suspendRangedAttackTimer = false;
468 {
469 for (Spell* spell : m_currentSpells)
470 {
471 if (spell)
472 {
473 if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
474 {
475 if (spell->IsChannelActive())
476 {
477 suspendRangedAttackTimer = true;
478 }
479
480 suspendAttackTimer = true;
481 break;
482 }
483 }
484 }
485 }
486
487 if (!suspendAttackTimer)
488 {
489 if (int32 base_attack = getAttackTimer(BASE_ATTACK))
490 {
491 setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32) p_time : 0);
492 }
493
494 if (int32 off_attack = getAttackTimer(OFF_ATTACK))
495 {
496 setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32) p_time : 0);
497 }
498 }
499
500 if (!suspendRangedAttackTimer)
501 {
502 if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK))
503 {
504 setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0);
505 }
506 }
507
508 // update abilities available only for fraction of time
509 UpdateReactives(p_time);
510
514
515 UpdateSplineMovement(p_time);
516 GetMotionMaster()->UpdateMotion(p_time);
517
519}
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition SharedDefines.h:1315
bool IsEmpty() const
Definition LinkedList.h:97
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition Map.h:387
void UpdateMotion(uint32 diff)
Definition MotionMaster.cpp:104
void _UpdateSpells(uint32 time)
Definition Unit.cpp:3844
void UpdateSplineMovement(uint32 t_diff)
Definition Unit.cpp:575
void UpdateReactives(uint32 p_time)
Definition Unit.cpp:16963
void ExecuteDelayedUnitAINotifyEvent()
Definition Unit.cpp:20533
void HandleProcExtraAttackFor(Unit *victim, uint32 count)
Definition Unit.cpp:2756
void SendThreatListUpdate()
Definition Unit.cpp:20101
virtual void Update(uint32 diff)
Definition Object.cpp:1061

References _lastDamagedTargetGuid, _lastExtraAttackSpell, _UpdateSpells(), AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, bRequestForcedVisibilityUpdate, CanHaveThreatList(), ClearInCombat(), ObjectGuid::Empty, ExecuteDelayedUnitAINotifyEvent(), extraAttacksTargets, WorldObject::FindMap(), getAttackTimer(), GetMotionMaster(), GetThreatMgr(), ObjectAccessor::GetUnit(), HandleProcExtraAttackFor(), HasUnitState(), HasUnitTypeMask(), HealthAbovePct(), HealthBelowPct(), Map::i_objectsForDelayedVisibility, InvalidateValuesUpdateCache(), IsAlive(), IsControlledByPlayer(), LinkedListHead::IsEmpty(), IsInCombat(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), m_CombatTimer, m_currentSpells, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_HostileRefMgr, ModifyAuraState(), OFF_ATTACK, RANGED_ATTACK, SendThreatListUpdate(), setAttackTimer(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_HACK_AND_SLASH, SPELL_SWORD_SPECIALIZATION, sScriptMgr, Object::ToPlayer(), UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_STATE_CASTING, WorldObject::Update(), MotionMaster::UpdateMotion(), UpdateReactives(), and UpdateSplineMovement().

Referenced by Creature::Update(), and Player::Update().

◆ UpdateAllResistances()

void Unit::UpdateAllResistances ( )
virtual

◆ UpdateAllStats()

virtual bool Unit::UpdateAllStats ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

◆ UpdateArmor()

virtual void Unit::UpdateArmor ( )
pure virtual

◆ UpdateAttackPowerAndDamage()

virtual void Unit::UpdateAttackPowerAndDamage ( bool  ranged = false)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateAuraForGroup()

void Unit::UpdateAuraForGroup ( uint8  slot)
17193{
17194 if (slot >= MAX_AURAS) // slot not found, return
17195 return;
17196 if (Player* player = ToPlayer())
17197 {
17198 if (player->GetGroup())
17199 {
17200 player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS);
17201 player->SetAuraUpdateMaskForRaid(slot);
17202 }
17203 }
17204 else if (IsCreature() && IsPet())
17205 {
17206 Pet* pet = ((Pet*)this);
17207 if (pet->isControlled())
17208 {
17209 Unit* owner = GetOwner();
17210 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
17211 {
17213 pet->SetAuraUpdateMaskForRaid(slot);
17214 }
17215 }
17216 }
17217}
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition Group.h:118
@ GROUP_UPDATE_FLAG_AURAS
Definition Group.h:109
#define MAX_AURAS
Definition SpellAuraDefines.h:21
void SetAuraUpdateMaskForRaid(uint8 slot)
Definition Pet.h:137

References Player::GetGroup(), GetOwner(), GROUP_UPDATE_FLAG_AURAS, GROUP_UPDATE_FLAG_PET_AURAS, Pet::isControlled(), Object::IsCreature(), IsPet(), Object::IsPlayer(), MAX_AURAS, Pet::SetAuraUpdateMaskForRaid(), Player::SetGroupUpdateFlag(), and Object::ToPlayer().

Referenced by RemoveVisibleAura(), and SetVisibleAura().

◆ UpdateCharmAI()

void Unit::UpdateCharmAI ( )
15808{
15809 if (IsPlayer())
15810 return;
15811
15812 if (i_disabledAI) // disabled AI must be primary AI
15813 {
15814 if (!IsCharmed())
15815 {
15816 delete i_AI;
15818 i_disabledAI = nullptr;
15819 }
15820 }
15821 else
15822 {
15823 if (IsCharmed())
15824 {
15826 if (isPossessed() || IsVehicle())
15827 i_AI = new PossessedAI(ToCreature());
15828 else
15829 i_AI = new PetAI(ToCreature());
15830 }
15831 }
15832}
Definition PetAI.h:47
Definition PassiveAI.h:37

References i_AI, i_disabledAI, IsCharmed(), Object::IsPlayer(), isPossessed(), IsVehicle(), and Object::ToCreature().

Referenced by Creature::Update().

◆ UpdateDamagePhysical()

void Unit::UpdateDamagePhysical ( WeaponAttackType  attType)
virtual

Reimplemented in Guardian, and Totem.

61{
62 float totalMin = 0.f;
63 float totalMax = 0.f;
64
65 float tmpMin, tmpMax;
66 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
67 {
68 CalculateMinMaxDamage(attType, false, true, tmpMin, tmpMax, i);
69 totalMin += tmpMin;
70 totalMax += tmpMax;
71 }
72
73 switch (attType)
74 {
75 case BASE_ATTACK:
76 default:
79 break;
80 case OFF_ATTACK:
83 break;
84 case RANGED_ATTACK:
87 break;
88 }
89}
void SetStatFloatValue(uint16 index, float value)
Definition Object.cpp:790

References BASE_ATTACK, CalculateMinMaxDamage(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, Object::SetStatFloatValue(), UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by Player::_ApplyAmmoBonuses(), Player::_ApplyWeaponDamage(), boss_twin_valkyrAI::boss_twin_valkyrAI(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleModAttackSpeed(), HandleStatModifier(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::npc_toc_enh_shamanAI(), Player::RemoveAmmo(), Creature::SetCanDualWield(), ScriptedAI::SetEquipmentSlots(), Creature::UpdateAttackPowerAndDamage(), and Player::UpdateAttackPowerAndDamage().

◆ UpdateHeight()

void Unit::UpdateHeight ( float  newZ)

Only server-side height update, does not broadcast to client.

20095{
20097 if (IsVehicle())
20099}
void RelocatePassengers()
Definition Vehicle.cpp:513

References Position::GetPositionX(), Position::GetPositionY(), GetVehicleKit(), IsVehicle(), Position::Relocate(), and Vehicle::RelocatePassengers().

Referenced by npc_dancing_flames::npc_dancing_flamesAI::Reset(), and SetHover().

◆ UpdateInterruptMask()

void Unit::UpdateInterruptMask ( )
755{
756 m_interruptMask = 0;
757 for (AuraApplicationList::const_iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i)
758 m_interruptMask |= (*i)->GetBase()->GetSpellInfo()->AuraInterruptFlags;
759
761 if (spell->getState() == SPELL_STATE_CASTING)
762 m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
763}

References CURRENT_CHANNELED_SPELL, m_currentSpells, m_interruptableAuras, m_interruptMask, and SPELL_STATE_CASTING.

Referenced by _UnapplyAura(), Spell::finish(), and RemoveAurasWithInterruptFlags().

◆ UpdateMaxHealth()

virtual void Unit::UpdateMaxHealth ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateMaxPower()

virtual void Unit::UpdateMaxPower ( Powers  power)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateObjectVisibility()

◆ UpdateOrientation()

void Unit::UpdateOrientation ( float  orientation)

Only server-side orientation update, does not broadcast to client.

20087{
20088 SetOrientation(orientation);
20089 if (IsVehicle())
20091}

References GetVehicleKit(), IsVehicle(), Vehicle::RelocatePassengers(), and Position::SetOrientation().

Referenced by Spell::UpdateChanneledTargetList(), and UpdatePosition().

◆ UpdatePosition() [1/2]

bool Unit::UpdatePosition ( const Position pos,
bool  teleport = false 
)
inline

◆ UpdatePosition() [2/2]

bool Unit::UpdatePosition ( float  x,
float  y,
float  z,
float  ang,
bool  teleport = false 
)
virtual

Reimplemented in Player.

20049{
20050 if (!Acore::IsValidMapCoord(x, y, z, orientation))
20051 return false;
20052
20053 float old_orientation = GetOrientation();
20054 float current_z = GetPositionZ();
20055 bool turn = (old_orientation != orientation);
20056 bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || current_z != z);
20057
20058 if (!GetVehicle())
20059 {
20060 uint32 mask = 0;
20061 if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING;
20062 if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE;
20063 if (mask)
20065 }
20066
20067 if (relocated)
20068 {
20069 if (IsPlayer())
20070 GetMap()->PlayerRelocation(ToPlayer(), x, y, z, orientation);
20071 else
20072 GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation);
20073 }
20074 else if (turn)
20075 {
20076 UpdateOrientation(orientation);
20077
20078 if (IsPlayer() && ToPlayer()->GetFarSightDistance())
20080 }
20081
20082 return (relocated || turn);
20083}
void PlayerRelocation(Player *, float x, float y, float z, float o)
Definition Map.cpp:1003
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition Map.cpp:1025
void UpdateOrientation(float orientation)
Only server-side orientation update, does not broadcast to client.
Definition Unit.cpp:20086
bool IsValidMapCoord(float c)
Definition GridDefines.h:215

References AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, Map::CreatureRelocation(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetVehicle(), Object::IsPlayer(), Acore::IsValidMapCoord(), Map::PlayerRelocation(), RemoveAurasWithInterruptFlags(), Object::ToCreature(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdateOrientation().

Referenced by npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_taldaram::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveRootAck(), WorldSession::HandleMoveUnRootAck(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), NearTeleportTo(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_skadi::boss_skadiAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_escortAI::SetNextWaypoint(), npc_escortAI::SetNextWaypoint(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), Player::UpdatePosition(), and UpdateSplinePosition().

◆ UpdateReactives()

void Unit::UpdateReactives ( uint32  p_time)
16964{
16965 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
16966 {
16967 ReactiveType reactive = ReactiveType(i);
16968
16969 if (!m_reactiveTimer[reactive])
16970 continue;
16971
16972 if (m_reactiveTimer[reactive] <= p_time)
16973 {
16974 m_reactiveTimer[reactive] = 0;
16975
16976 switch (reactive)
16977 {
16978 case REACTIVE_DEFENSE:
16981 break;
16985 break;
16986 case REACTIVE_OVERPOWER:
16988 {
16990 }
16991 break;
16993 if (IsHunterPet())
16995 break;
16996 default:
16997 break;
16998 }
16999 }
17000 else
17001 {
17002 m_reactiveTimer[reactive] -= p_time;
17003 }
17004 }
17005}
ReactiveType
Definition Unit.h:593

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), IsHunterPet(), m_reactiveTimer, MAX_REACTIVE, ModifyAuraState(), REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, and REACTIVE_WOLVERINE_BITE.

Referenced by Update().

◆ UpdateResistances()

virtual void Unit::UpdateResistances ( uint32  school)
pure virtual

Implemented in Creature, Player, and Totem.

Referenced by HandleStatModifier(), and UpdateAllResistances().

◆ UpdateSpeed()

void Unit::UpdateSpeed ( UnitMoveType  mtype,
bool  forced 
)
Todo:
possible affect only on MOVE_RUN
14274{
14275 int32 main_speed_mod = 0;
14276 float stack_bonus = 1.0f;
14277 float non_stack_bonus = 1.0f;
14278
14279 switch (mtype)
14280 {
14281 // Only apply debuffs
14282 case MOVE_FLIGHT_BACK:
14283 case MOVE_RUN_BACK:
14284 case MOVE_SWIM_BACK:
14285 case MOVE_WALK:
14286 break;
14287 case MOVE_RUN:
14288 {
14289 if (IsMounted()) // Use on mount auras
14290 {
14294 }
14295 else
14296 {
14300 }
14301 break;
14302 }
14303 case MOVE_SWIM:
14304 {
14305 // xinef: check for forced_speed_mod of sea turtle
14307 for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr)
14308 {
14309 // xinef: sea turtle only, it is not affected by any increasing / decreasing effects
14310 if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/)
14311 {
14312 SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced);
14313 return;
14314 }
14315 else if (
14316 // case: increase speed
14317 ((*itr)->GetAmount() > 0 && (*itr)->GetAmount() > main_speed_mod) ||
14318 // case: decrease speed
14319 ((*itr)->GetAmount() < 0 && (*itr)->GetAmount() < main_speed_mod)
14320 )
14321 {
14322 main_speed_mod = (*itr)->GetAmount();
14323 }
14324 }
14325 break;
14326 }
14327 case MOVE_FLIGHT:
14328 {
14329 if (IsCreature() && IsControlledByPlayer()) // not sure if good for pet
14330 {
14333
14334 // for some spells this mod is applied on vehicle owner
14335 int32 owner_speed_mod = 0;
14336
14337 if (Unit* owner = GetCharmer())
14338 owner_speed_mod = owner->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
14339
14340 main_speed_mod = std::max(main_speed_mod, owner_speed_mod);
14341 }
14342 else if (IsMounted())
14343 {
14347 }
14348 else // Use not mount (shapeshift for example) auras (should stack)
14349 {
14353 }
14354
14355 // Update speed for vehicle if available
14356 if (IsPlayer() && GetVehicle())
14358 break;
14359 }
14360 default:
14361 LOG_ERROR("entities.unit", "Unit::UpdateSpeed: Unsupported move type ({})", mtype);
14362 return;
14363 }
14364
14365 // now we ready for speed calculation
14366 float speed = std::max(non_stack_bonus, stack_bonus);
14367 if (main_speed_mod)
14368 AddPct(speed, main_speed_mod);
14369
14370 switch (mtype)
14371 {
14372 case MOVE_RUN:
14373 case MOVE_SWIM:
14374 case MOVE_FLIGHT:
14375 {
14376 // Set creature speed rate
14377 if (IsCreature())
14378 {
14379 if (IsPet() && ToPet()->isControlled() && IsControlledByPlayer())
14380 {
14381 // contant value for player pets
14382 speed *= 1.15f;
14383 }
14384 else
14385 {
14386 speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
14387 }
14388 }
14389
14390 // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
14393 {
14394 if (Creature* creature = ToCreature())
14395 {
14396 uint32 immuneMask = creature->GetCreatureTemplate()->MechanicImmuneMask;
14397 if (immuneMask & (1 << (MECHANIC_SNARE - 1)) || immuneMask & (1 << (MECHANIC_DAZE - 1)))
14398 break;
14399 }
14400
14401 // Use speed from aura
14402 float max_speed = normalization / (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]);
14403 if (speed > max_speed)
14404 speed = max_speed;
14405 }
14406 break;
14407 }
14408 default:
14409 break;
14410 }
14411
14412 int32 slowFromHealth = 0;
14413 Creature* creature = ToCreature();
14414 // ignore pets, player owned vehicles, and mobs immune to snare
14415 if (creature
14416 && !IsPet()
14417 && !(IsControlledByPlayer() && IsVehicle())
14419 && !(creature->IsDungeonBoss()))
14420 {
14421 // 1.6% for each % under 30.
14422 // use min(0, health-30) so that we don't boost mobs above 30.
14423 slowFromHealth = (int32) std::min(0.0f, (1.66f * (GetHealthPct() - 30.0f)));
14424 }
14425
14426 if (slowFromHealth)
14427 {
14428 AddPct(speed, slowFromHealth);
14429 }
14430
14431 // Apply strongest slow aura mod to speed
14433 if (slow)
14434 AddPct(speed, slow);
14435
14436 if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
14437 {
14438 float base_speed = (IsCreature() ? ToCreature()->GetCreatureTemplate()->speed_run : 1.0f);
14439 float min_speed = base_speed * (minSpeedMod / 100.0f);
14440 if (speed < min_speed)
14441 speed = min_speed;
14442 }
14443
14444 SetSpeed(mtype, speed, forced);
14445}
@ MECHANIC_DAZE
Definition SharedDefines.h:1352
@ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
Definition SpellAuraDefines.h:269
@ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
Definition SpellAuraDefines.h:272
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition SpellAuraDefines.h:94
@ SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
Definition SpellAuraDefines.h:271
@ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
Definition SpellAuraDefines.h:235
@ SPELL_AURA_MOD_SPEED_NOT_STACK
Definition SpellAuraDefines.h:234
@ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACKING
Definition SpellAuraDefines.h:273
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
Definition SpellAuraDefines.h:121
@ SPELL_AURA_MOD_MINIMUM_SPEED
Definition SpellAuraDefines.h:368
@ SPELL_AURA_MOD_SPEED_ALWAYS
Definition SpellAuraDefines.h:192
@ SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING
Definition SpellAuraDefines.h:274
@ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
Definition SpellAuraDefines.h:193
@ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
Definition SpellAuraDefines.h:254
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:14452
float speed_run
Definition CreatureData.h:201

References AddPct(), baseMoveSpeed, GetAuraEffectsByType(), GetCharmer(), Creature::GetCreatureTemplate(), GetHealthPct(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), GetVehicle(), GetVehicleBase(), Creature::HasMechanicTemplateImmunity(), IsControlledByPlayer(), Object::IsCreature(), Creature::IsDungeonBoss(), IsMounted(), IsPet(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MECHANIC_DAZE, MECHANIC_SNARE, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, playerBaseMoveSpeed, SetSpeed(), CreatureTemplate::speed_run, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING, SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACKING, SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, SPELL_AURA_MOD_MINIMUM_SPEED, SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK, SPELL_AURA_MOD_SPEED_ALWAYS, SPELL_AURA_MOD_SPEED_NOT_STACK, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, Object::ToCreature(), ToPet(), and UpdateSpeed().

Referenced by Creature::DoFleeToGetAssistance(), AuraEffect::HandleAuraModDecreaseSpeed(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModIncreaseSpeed(), AuraEffect::HandleAuraModIncreaseSwimSpeed(), AuraEffect::HandleAuraModUseNormalSpeed(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), RemoveCharmedBy(), SetHealth(), SetInCombatState(), SetSpeed(), and UpdateSpeed().

◆ UpdateSplineMovement()

void Unit::UpdateSplineMovement ( uint32  t_diff)
private
576{
577 if (movespline->Finalized())
578 return;
579
580 // xinef: process movementinform
581 // this code cant be placed inside EscortMovementGenerator, because we cant delete active MoveGen while it is updated
582 SplineHandler handler(this);
583 movespline->updateState(t_diff, handler);
584 // Xinef: Spline was cleared by StopMoving, return
585 if (!movespline->Initialized())
586 {
588 return;
589 }
590
591 bool arrived = movespline->Finalized();
592
593 if (arrived)
594 {
596
597 if (movespline->HasAnimation() && IsCreature() && IsAlive())
599 }
600
601 // pussywizard: update always! not every 400ms, because movement generators need the actual position
602 //m_movesplineTimer.Update(t_diff);
603 //if (m_movesplineTimer.Passed() || arrived)
605}
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition UnitDefines.h:26
uint8 GetAnimationType() const
Definition MoveSpline.h:125
void updateState(int32 difftime, UpdateHandler &handler)
Definition MoveSpline.h:98
bool HasAnimation() const
Definition MoveSpline.h:124
Definition Unit.cpp:555

References DisableSpline(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::GetAnimationType(), Movement::MoveSpline::HasAnimation(), Movement::MoveSpline::Initialized(), IsAlive(), Object::IsCreature(), movespline, Object::SetByteValue(), UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, UpdateSplinePosition(), and Movement::MoveSpline::updateState().

Referenced by Update().

◆ UpdateSplinePosition()

void Unit::UpdateSplinePosition ( )
private
608{
609 //static uint32 const positionUpdateDelay = 400;
610
611 //m_movesplineTimer.Reset(positionUpdateDelay);
613
615 {
617 pos.m_positionX = loc.x;
618 pos.m_positionY = loc.y;
619 pos.m_positionZ = loc.z;
621
622 if (TransportBase* transport = GetDirectTransport())
623 transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
624 }
625
626 // Xinef: if we had spline running update orientation along with position
627 //if (HasUnitState(UNIT_STATE_CANNOT_TURN))
628 // loc.orientation = GetOrientation();
629
630 if (IsPlayer())
631 UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
632 else
633 ToCreature()->SetPosition(loc.x, loc.y, loc.z, loc.orientation);
634}
void SetPosition(float x, float y, float z, float o)
Definition Creature.cpp:3154
Location ComputePosition() const
Definition MoveSpline.cpp:26
bool onTransport
Definition MoveSpline.h:127
Definition VehicleDefines.h:130
TransportBase * GetDirectTransport() const
Definition Unit.cpp:18790
Position pos
Definition Object.h:302
Definition MoveSpline.h:27
float orientation
Definition MoveSpline.h:33
float m_positionZ
Definition Position.h:57
float m_positionX
Definition Position.h:55
float m_positionY
Definition Position.h:56

References Movement::MoveSpline::ComputePosition(), GetDirectTransport(), Object::IsPlayer(), WorldObject::m_movementInfo, Position::m_positionX, Position::m_positionY, Position::m_positionZ, movespline, Movement::MoveSpline::onTransport, Movement::Location::orientation, MovementInfo::TransportInfo::pos, Position::SetOrientation(), Creature::SetPosition(), Object::ToCreature(), MovementInfo::transport, and UpdatePosition().

Referenced by StopMoving(), and UpdateSplineMovement().

◆ UpdateStats()

virtual bool Unit::UpdateStats ( Stats  stat)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ Whisper() [1/2]

void Unit::Whisper ( std::string_view  text,
Language  language,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

21178{
21179 if (!target)
21180 {
21181 return;
21182 }
21183
21185 WorldPacket data;
21186 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, language, this, target, text, 0, "", locale);
21187 target->SendDirectMessage(&data);
21188}
LocaleConstant
Definition Common.h:65
@ CHAT_MSG_MONSTER_WHISPER
Definition SharedDefines.h:3167
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition SharedDefines.h:3194
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:264
LocaleConstant GetSessionDbLocaleIndex() const
Definition WorldSession.h:512

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), and Player::SendDirectMessage().

Referenced by npc_commandscript::HandleNpcWhisperCommand(), spell_lich_king_whisper::HandleScript(), Map::ScriptsProcess(), and boss_zuramat::boss_zuramatAI::UpdateAI().

◆ Whisper() [2/2]

void Unit::Whisper ( uint32  textId,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

21236{
21237 if (!target)
21238 {
21239 return;
21240 }
21241
21242 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
21243 if (!bct)
21244 {
21245 LOG_ERROR("entities.unit", "Unit::Whisper: `broadcast_text` was not {} found", textId);
21246 return;
21247 }
21248
21250 WorldPacket data;
21251 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
21252 target->SendDirectMessage(&data);
21253}
Definition ObjectMgr.h:434

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, getGender(), Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, Player::SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

void Unit::Yell ( std::string_view  text,
Language  language,
WorldObject const *  target = nullptr 
)
virtual

◆ Yell() [2/2]

void Unit::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

21226{
21227 Talk(textId, CHAT_MSG_MONSTER_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
21228}

References CHAT_MSG_MONSTER_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Member Data Documentation

◆ _charmThreatInfo

CharmThreatMap Unit::_charmThreatInfo
protected

Referenced by RemoveCharmedBy().

◆ _instantCast

bool Unit::_instantCast
protected

◆ _isWalkingBeforeCharm

bool Unit::_isWalkingBeforeCharm
private

Are we walking before we were charmed?

Referenced by SetCharm(), and Unit().

◆ _lastDamagedTargetGuid

◆ _lastExtraAttackSpell

uint32 Unit::_lastExtraAttackSpell
private

◆ _lastLiquid

LiquidTypeEntry const* Unit::_lastLiquid
protected

◆ _oldFactionId

uint32 Unit::_oldFactionId
private

faction before charm

Referenced by GetOldFactionId(), RemoveCharmedBy(), SetCharmedBy(), and Unit().

◆ _redirectThreatInfo

◆ _valuesUpdateCache

ValuesUpdateCache Unit::_valuesUpdateCache
private

◆ bRequestForcedVisibilityUpdate

◆ extraAttacksTargets

std::unordered_map<ObjectGuid , uint32 > Unit::extraAttacksTargets
private

Referenced by AddExtraAttacks(), and Update().

◆ i_AI

◆ i_disabledAI

UnitAI* Unit::i_disabledAI
protected

Referenced by UpdateCharmAI().

◆ i_motionMaster

MotionMaster* Unit::i_motionMaster
protected

◆ IsAIEnabled

◆ m_appliedAuras

◆ m_applyResilience

bool Unit::m_applyResilience
protected

◆ m_attackers

◆ m_attacking

Unit* Unit::m_attacking
protected

◆ m_attackTimer

◆ m_auraModifiersGroup

◆ m_auraStateAuras

◆ m_auraUpdateIterator

AuraMap::iterator Unit::m_auraUpdateIterator
protected

◆ m_AutoRepeatFirstCast

bool Unit::m_AutoRepeatFirstCast
protected

◆ m_baseSpellCritChance

◆ m_canDualWield

bool Unit::m_canDualWield

◆ m_canModifyStats

bool Unit::m_canModifyStats
protected

◆ m_charmInfo

◆ m_cleanupDone

bool Unit::m_cleanupDone
private

◆ m_CombatTimer

uint32 Unit::m_CombatTimer
private

◆ m_ComboPointHolders

std::unordered_set<Unit*> Unit::m_ComboPointHolders
private

◆ m_comboPoints

int8 Unit::m_comboPoints
private

◆ m_comboTarget

◆ m_Controlled

◆ m_ControlledByPlayer

bool Unit::m_ControlledByPlayer

◆ m_CreatedByPlayer

bool Unit::m_CreatedByPlayer

◆ m_createStats

float Unit::m_createStats[MAX_STATS]
protected

◆ m_currentSpells

◆ m_deathState

◆ m_delayed_unit_ai_notify_timer

uint16 Unit::m_delayed_unit_ai_notify_timer

Referenced by Unit(), and Update().

◆ m_delayed_unit_relocation_timer

uint16 Unit::m_delayed_unit_relocation_timer

Referenced by Unit(), Player::Update(), and Update().

◆ m_Diminishing

◆ m_duringRemoveFromWorld

bool Unit::m_duringRemoveFromWorld
private

◆ m_dynObj

◆ m_extraAttacks

uint32 Unit::m_extraAttacks

◆ m_FollowingRefMgr

FollowerRefMgr Unit::m_FollowingRefMgr
private

Referenced by addFollower().

◆ m_gameObj

◆ m_HostileRefMgr

HostileRefMgr Unit::m_HostileRefMgr
private

◆ m_interruptableAuras

◆ m_interruptMask

◆ m_last_notify_mstime

uint32 Unit::m_last_notify_mstime

◆ m_last_notify_position

◆ m_lastManaUse

uint32 Unit::m_lastManaUse
private

◆ m_lastSanctuaryTime

uint32 Unit::m_lastSanctuaryTime

◆ m_modAttackSpeedPct

◆ m_modAuras

◆ m_modMeleeHitChance

◆ m_modRangedHitChance

◆ m_modSpellHitChance

◆ m_movedByPlayer

◆ m_ObjectSlot

◆ m_ownedAuras

◆ m_petAuras

PetAuraSet Unit::m_petAuras

◆ m_procDeep

int32 Unit::m_procDeep
protected

Referenced by CanProc(), and SetCantProc().

◆ m_race

uint8 Unit::m_race
protected

◆ m_reactiveTimer

uint32 Unit::m_reactiveTimer[MAX_REACTIVE]
protected

◆ m_realRace

uint8 Unit::m_realRace
protected

◆ m_regenTimer

◆ m_removedAuras

AuraList Unit::m_removedAuras
protected

◆ m_removedAurasCount

uint32 Unit::m_removedAurasCount
protected

◆ m_rootTimes

uint32 Unit::m_rootTimes
protected

Referenced by SetRooted(), and Unit().

◆ m_scAuras

AuraList Unit::m_scAuras
protected

◆ m_sharedVision

◆ m_speed_rate

float Unit::m_speed_rate[MAX_MOVE_TYPE]
protected

◆ m_spellImmune

◆ m_state

uint32 Unit::m_state
private

◆ m_SummonSlot

◆ m_ThreatMgr

◆ m_threatModifier

float Unit::m_threatModifier[MAX_SPELL_SCHOOL]

◆ m_transform

uint32 Unit::m_transform
protected

Referenced by getTransForm(), setTransForm(), and Unit().

◆ m_unitTypeMask

◆ m_vehicle

◆ m_vehicleKit

Vehicle* Unit::m_vehicleKit
protected

◆ m_visibleAuras

◆ m_weaponDamage

◆ movespline

◆ NeedChangeAI

bool Unit::NeedChangeAI

◆ SafeUnitPointerSet

std::set<SafeUnitPointer*> Unit::SafeUnitPointerSet

The documentation for this class was generated from the following files: